Invoke-Command -ComputerName Server01 -ScriptBlock {
param ($first)
Write-Output "The value of `$a is: $first"
} -ArgumentList $a
The value of $a is: @('1','2','3')
Hi guys, how can i pass $a as an array in remote session ????.
Invoke-Command -ComputerName Server01 -ScriptBlock {
param ($first)
Write-Output "The value of `$a is: $first"
} -ArgumentList $a
The value of $a is: @('1','2','3')
Hi guys, how can i pass $a as an array in remote session ????.
One way:
Invoke-command -ScriptBlock {param($first) Write-output $first} -argumentlist @(,(1,2,3))
1
2
3