Lerch Web Wiki

Random, erratic, no responsibility is taken for the correctness of this information

User Tools

Site Tools



$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'}}
$job = Start-Job -ScriptBlock $sb
$job | Wait-Job
$job | Receive-Job
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
powershell/basics/jobs.txt · Last modified: 2020/03/24 09:01 (external edit)