How to validate if IP is within infrastructure with PowerCLI

You are here:
< Back

Just a little script I saw from Anthony Burke that displays a list of VM name, IP Address, Power State, VMTools Status and VMTools Version.
A blank IP address field indicates power of VM off or VMTools not installed.


Get-VM | Select Name, @{N="IP Address";E={@($_.Guest.IPAddress[0])}}, @{N="PowerState";E={@($_.PowerState)}}, @{N="VMTools Status";E={@($_.ExtensionData.Guest.ToolsStatus)}}, @{N="VMTools Version";E={@($_.Guest.ToolsVersion)}} | ft -auto

 

 

Here is another version, which allows you search by an IP.


$ipsearch = "10.35.254.9”
Get-VM | Select Name, @{N="IP Address";E={@($_.Guest.IPAddress[0])}}, @{N="PowerState";E={@($_.PowerState)}}, @{N="VMTools Status";E={@($_.ExtensionData.Guest.ToolsStatus)}}, @{N="VMTools Version";E={@($_.Guest.ToolsVersion)}} | ? {$_."IP Address" -eq ("$ipsearch")} | ft -auto