other

Powershell change mac addresses to static

$MYVMs=(Get-VM | Where { $_.State -eq "Running" } )
foreach ($VM in $MYVMs) {
	$VMNet=Get-VMNetworkAdapter -VMName $VM.NAME
    $VM.Name
    Save-VM -Name $VM.Name
    foreach ($VMAd in $VMNet) {
        $MyMac=$VMAd | Select MacAddress
        Set-VMNetworkAdapter -VMNetworkAdapter $VMAd -StaticMacAddress $MyMac.MacAddress
    }
    Start-VM  -Name $VM.Name
    Pause

}
Was this helpful?