Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 175326

Sorting VM IP against a list from a text file

$
0
0

Happy Friday, PowerCLI community

 

I have been tasked with getting a list of VMs that have IP addresses that match the IPs on a list, given to me in a text file.

 

My thought was then to import the text file as an array, look for VMs where the calculated IP address would match any in the array.

 

What I did looks like this:

 

$ipadds = Get-Content .\Documents\ntp_queries.txt

 

Get-VM | where {$_.@{N="IP Address";E={@($_.guest.IPAddress[0])}} -like $ipadds }

select Name,PowerState, @{N="IP Address";E={@($_.guest.IPAddress[0])}} | Out-GridView

 

Runs fine, but wit no output, so I assume my filter is not written properly....

 

any ideas?


Viewing all articles
Browse latest Browse all 175326

Trending Articles



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