I have a script I’m writing that works great when the data is piped in,
gc .\Desktop\PCs.txt |Repair-WinAgent
but when I run it with an array in the parameter, it attempts to process all values in the array as one big long string.
Repair-WinAgent -ComputerName (gc .\Desktop\PCs.txt)
here’s my param section.
Param ( # Hostname(s) or IP Address(es) of the system(s) with the agent issue. Can be piped in as a [string] value. [Parameter(ValueFromPipeline=$true)] [string] $ComputerName = 'localhost' )