Hi,
I ran into an issue today where a server was complaining about a duplicate MAC address. Since almost all of our servers were virtual, I thought the best step (after doing an arp -a command locally and seeing if the offending IP address/MAC address was listed – which it wasn’t) would be to do a quick Google to see if there was an easy way without checking each VM.
Of course there is, thanks to Powershell. I quickly found this blog post from The Daily Admin and gave it a try. There was one slight change I had to make to get it to work:
Using the “Virtual Machine Manager Command Shell” I tried the command from the link above:
Get-VMMServer | get-vm | Get-VirtualNetworkAdapter | select name,EthernetAddress | export-csv “c:\temp\VM_Macs.csv”
It prompted for a Computer name. After working out you needed to specify your SCVMM server in the first part after ‘Get-VMMServer’ as per this:
Get-VMMServer “ScvmmServerName”| get-vm | Get-VirtualNetworkAdapter | select name,EthernetAddress | export-csv “c:\temp\VM_Macs.csv”
It worked perfectly. The resulting CSV file had a full list of the MAC addresses, which helped me narrow down what I was looking for.
Full credit to The Daily Admin at http://www.thedailyadmin.com/ !
Awesome, made my day. Had a duplicate IP that was knocking a switch off our LAN. Found the offending mac on the Cisco, but wasn’t showing up when doing MAC scans on the LAN. Ran this command on my VMM and found the culprit. Was an old server we setup temporarily many months ago with the same IP. We forgot about it when setting up some new switches
Thanks!
Glad to hear it helped!
Where does it get the VM Names from? Mine shows a server name (or is it the name (label) in VMM) that does not show in the VMM console…
Thanks
C.
I guess I mean is this the HOST name or the name that shows in VMM.
Try the command ‘get-vm vmnamehere’ and you’ll see the full results for the vm object, including name. I don’t know what the name field maps to specifically compared to the VMM gui, but the results should give you an idea of the different fields.
Also, it’s probably not the host name, there’s a seperate ‘hostname’ result. If you want to see that instead, just swap ‘name’ to ‘hostname’ in the script:
Get-VMMServer “ScvmmServerName”| get-vm | Get-VirtualNetworkAdapter | select hostname,EthernetAddress | export-csv “c:\temp\VM_Macs.csv”