ArgumentList parameter in Invoke-Command don't send all array ArgumentList parameter in Invoke-Command don't send all array powershell powershell

ArgumentList parameter in Invoke-Command don't send all array


You solution is to pass it like (,$servicesList)

$session = New-PSSession -ComputerName .$servicesList = "Service1", "Service2", "Service3"Invoke-Command -ScriptBlock {    Param ([string[]]$newServicesList)    Write-Host $newServicesList} -ArgumentList (,$servicesList) -Session $sessionRemove-PSSession  $session

possible explanation from this SO answer.