在PowerShell远程会话中传递数组

在PowerShell远程会话中传递数组,powershell,Powershell,大家好,我如何在远程会话中将$a作为数组传递??。单向: 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') 我不是落选者..谢谢@CB。我不明白为什么人们即使有真正的疑问也会投票反对。我想stackexchange

大家好,我如何在远程会话中将$a作为数组传递??。

单向:

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')

我不是落选者..谢谢@CB。我不明白为什么人们即使有真正的疑问也会投票反对。我想stackexchange管理员应该看看这个。谢谢你的回复。
Invoke-command -ScriptBlock {param($first) Write-output $first} -argumentlist @(,(1,2,3))

1
2
3