How do I get PowerShell to wait until the Invoke-Item call has finished? I\'m invoking a non-executable item, so I need to use Invoke-Item to open it.
$session = New-PSSession -ComputerName "xxxxx" -Name "mySession" $Job = Invoke-Command -Session $session -FilePath "xxxxx" -AsJob Wait-Job -Job $Job