$ar = @("a","b","c") invoke-command -ArgumentList $ar -ComputerName mypc1 -ScriptBlock {param($opts);write-host $opts;write-host $opts.length}
Result:
a
1
To read in the array correctly, use the syntax (,$myArray)
$ar = @("a","b","c") invoke-command -ArgumentList (,$ar) -ComputerName mypc1 -ScriptBlock {param($opts);write-host $opts;write-host $opts.count}
Result:
a b c
3
No comments:
Post a Comment