Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 230663

Find VM via IP

$
0
0

Hey all,

 

I'm trying to figure out a way to find a VM via IP through PowerCLI. That in itself is easy enough, and I'm using this code currently:

 

Get-View -ViewType VirtualMachine -Filter @{"Guest.IpAddress"="x.x.x.x"}

 

The issue is that the IP I need to track by isn't directly on the Guest.IpAddress property (multiple NICs), but it is actually located at Guest.Net.IpAddress. I can find the IP by using:

 

Get-View -ViewType VirtualMachine -Filter @{"Name"="VMName"} | Select -ExpandProperty Guest | Select -ExpandProperty Net | Select -ExpandProperty IpAddress

 

This returns three IPs and one is the IP I need. What I can't figure out how to do is filter using it. Trying the following results in invalid property, and I imagine it's because it's an array:

 

Get-View -ViewType VirtualMachine -Filter @{"Guest.Net.IpAddress"="x.x.x.x"}

 

Anyone know how I could get this filter working?

 

~Brandit


Viewing all articles
Browse latest Browse all 230663

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>