your home for end-user virtualization!

How to find virtual machine name from the MAC address using PowerCLI

So, after the mess this week… I had an IP conflict on my vCenter test server… Luckily Server 2008 told me the MAC of the offending machine. Which just happened to have a VMware Mac :)

I busted out the trusty PowerCLI and this is what I came up with!


$report =@() 
Get-VM | Get-View | %{ 
 $VMname = $_.Name 
 $_.guest.net | where {$_.MacAddress -eq "00:50:56:4b:29:33"} | %{
        $row = "" | Select VM, MAC
        $row.VM = $VMname 
        $row.MAC = $_.MacAddress 
        $report += $row 
  } 
  } 
$report

Search

Categories