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

using -match I want to write output in a statement

$
0
0

I'm trying to write a script that connects to a vcenter server and searches for a vm with an ip address that gets entered by the person running the script.  I've got it working pretty good with the exception if I try to format the output (I want it to give me the vm name when it finds the ip address or tell me that it didn't find a match) with an if / else statement I don't get any results when a match is found.  I'm not sure where/how the "match" information is kept so I can return it to the end user. If i just run $array -match $match_address it returns the information but with the formatting :

 

if ($array -match $match_address)

  {Write-host "Match Found $_."}

 

 

it just tells me "Match Found ."  Where / how does the match get stored?

I've attached the script to this post for help.

 

Thanks.


Viewing all articles
Browse latest Browse all 168455

Trending Articles



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