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

Re: PowerCli : Read from URL

$
0
0

Did you try it like this

 

$url="http://server-name/folder/hosts_in_mm_list.txt"$file="c:\names.txt"$web=New-ObjectSystem.Net.WebClient$web.DownloadFile($url,$file)
$content
=Get-Content$file
$tgtHosts
="host1","host2","host3"
$tgtComment
="Target comment"
$hostnames
=$content|%$hostname,$comment=$_.Split(','if($tgtHosts-contains$hostname-and$tgtComment-eq$comment){    $hostname
  } }

 

If that doesn't work, can you attach the file you downloaded, so I can have a look how the content looks ?


Viewing all articles
Browse latest Browse all 232869

Trending Articles



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