Why when I query something like a csv or use get-content on a text file with a list of hostnames does the subsequent command choke on headers and such?
Example:
I wanted to run something like #invoke-command -computername (Get-content C:\somefile.txt) -scriptblock {get-process}
Instead I had to take the variable that I had make “somefile.txt” with and do the following top it
foreach($i in $pclist) {$tryme = $tryme + $i.Hostname}
Now #invoke-command -computername $tryme -scriptblock {get-process} is working fine