How to capture the exception raised in the scriptblock of start-job?
问题 I have the following script, $createZip = { Param ([String]$source, [String]$zipfile) Process { echo "zip: $source`n --> $zipfile" throw "test" } } try { Start-Job -ScriptBlock $createZip -ArgumentList "abd", "acd" echo "**Don't reach here if error**" LogThezippedFile } catch { echo "Captured: " $_ | fl * -force } Get-Job | Wait-Job Get-Job | receive-job Get-Job | Remove-Job However, the exception raised in another powershell instance cannot be captured. What's the best way to capture the