Random, erratic, no responsibility is taken for the correctness of this information
$job = start-job { $(Write-Verbose "Verbose 1" -verbose; 1..10 | % { "Output $_" }; Write-Verbose "Verbose 2" -verbose) *>&1 } $job | Wait-Job # Verbose data is part of the job output stream now. $results = $job.ChildJobs[0].Output Write-Output $results # Can also retrieve from Receive-Job $results = Receive-Job $job -Keep Write-Output $results
$sb = { if ($PSCommandPath) {Write-Output ('running direct')} else {Write-Output 'running as job'}} &$sb $job = Start-Job -ScriptBlock $sb $job | Wait-Job $job | Receive-Job