Thursday, July 7, 2011

Duplicate MAC Addresses in SCVMM and Hyper-V

There is a possiblity that duplicate MAC addresses can occur in Hyper-V (specifically when configuring networks using Hyper-V). As an example, if the machine is created with SCVMM and then the network is configured using Hyper-V, there could be a duplicate MAC. If the VM was created with Hyper-V and later migrated to a SCVMM host, this duplication could still happen. If the VM has been registered with SCVMM (regardless of how the network was configured), the script below will output a CSV of the VM name and the MAC(s). Using Excel to quickly find duplicates is an easy way to avoid network headaches. If a duplicate is found, the simple fix is to add a new network card through SCVMM which will ensure that the MAC is not duplicated.

add-pssnapin Microsoft.SystemCenter.VirtualMachineManager
Get-VMMServer | get-vm | Get-VirtualNetworkAdapter | select name,EthernetAddress | export-csv "c:\temp\VM_Macs.csv"

1 comment:

Lindy said...

Thanks! I have to rebuild my SCVMM server and I had a few dupes. Your script allowed me to find them and reset the range so the starting number was the next unused MAC.