Finding a VM with a Particular MAC Address
One of my customers was recently troubleshooting a network issue and had tracked it down to a single VMware MAC Address. They tasked me with finding that VM that had that MAC address assigned, which is not a simple process through the GUI. Fortunately, it's a very easy problem to solve with a script, and so PowerCLI to the rescue. All that I did with this script was get all of the VMs from vCenter, then loop through each one getting all of their NICs. I then compared the MAC of that NIC against the MAC that the customer had identified, and we very swiftly had identified the problem VM. $MacOfInterest = "00:50:56:7b:00:00" $allVMs = Get-VM foreach ($thisVM in $allVMs) { foreach ($thisAdapter in ($thisVM | Get-NetworkAdapter)) { if ($thisAdapter.MacAddress -eq $MacOfInterest) { echo $thisVM.name } } }