Reputation: 21194
We start a Powershell function via Start-Job
and want to retrieve its output in the caller in real time. Is there a nice way to do so without calling Retrieve-Job
in a loop?
Upvotes: 5
Views: 3162
Reputation: 3571
Try something like this:
$appJob = Start-Job { foreach($i in 1..10) { Write-Output "Testing $i"; Start-Sleep 10 } }
$appJob.ChildJobs[0].Output
Upvotes: 2