首先是短代码,然后是问题
$session = New-PSSession -ComputerName someServer
$servicesList = "Service1", "Service2", "Service3"
Invoke-Command -ScriptBlock {
Param ($newServicesList)
Write-Host $newServicesList
} -ArgumentList $servicesList -Session $session
Remove-PSSession $session
问题是为什么 Invoke-Command 块中的 Write-Host 只给出这个输出?
Service1
感谢您的任何回答