Short, simple script to list all VM’s which has NIC’s with a Dynamic MAC Address set.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# Get all VM's from Localhost (change to SCVMM Server if running remote) $AllVMS = Get-SCVirtualMachine -VMMServer localhost $DynamicVMs = @() # For each VM, check Virtual Network Adapters if Mac = Dynamic. foreach ($vm in $AllVMS ) { $vmnics = $vm | Get-SCVirtualNetworkAdapter if ($vmnics.MACAddressType -eq "Dynamic") { $DynamicVMs += $vm.Name } } # List all VM's with a Dynamic Mac address. $DynamicVMs | Sort-Object Write-Output "--------" $DynamicVMs.Count |
It will give a list of all VM’s and the number of VM’s in that list.
Small, simple and efficient.
Thank you! Fixed 🙂
Must have missed that variable when I cleaned up the script for publishing.
line 6 should be:
foreach ($vm in $AllVMS) {