VMware: Find VMs by IP Address

Hi,

sometimes you want to find which IP Address belongs to a virtual machine. This can be easily done by powercli, provided that the VMware Tools are installed in each VM.

To find a specifc IP Address

Get-VM * |where-object{$_.Guest.IPAddress -match "10.254.1.34"}

It also works if you just have a part a the Address

Get-VM * |where-object{$_.Guest.IPAddress -match "10.254.1"}

To get a list of all IP Address

$aAllIPs=Get-VM * |%{$_.Guest}|%{$_.IPAddress}

Michael

Advertisment to support michlstechblog.info

2 thoughts on “VMware: Find VMs by IP Address”

  1. There is a limitation or bug in BOTH the GUI and the CLI. If a VM NIC has multiple IP addresses, only the first IP is found or reported. This is vCenter 6.5

  2. Seems to be a problem if both IPs are in the similar range, i.e., last octet is .41-.49 (match only matches on the first .4x found, 2nd and subsequent .4y not reported). Example: matches to report .41, but does not report .42

Leave a Reply to George Perkins Cancel reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.