Skip to content

Instantly share code, notes, and snippets.

@martin9700
Created June 22, 2014 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save martin9700/ce920a98e1bf0dca6038 to your computer and use it in GitHub Desktop.
Save martin9700/ce920a98e1bf0dca6038 to your computer and use it in GitHub Desktop.
$Count = 0
Do {
$TotProg = 0
ForEach ($Job in $Jobs)
{ Try {
$Prog = ($Job | Get-Job).ChildJobs[0].Progress.StatusDescription[-1]
If ($Prog -is [char])
{ $Prog = 0
}
$TotProg += $Prog
}
Catch {
Start-Sleep -Milliseconds 500
Break
}
}
Write-Progress -Id 1 -Activity "Watching Background Jobs" -Status "Waiting for background jobs to complete: $TotProg of $Total" -PercentComplete (($TotProg / $Total) * 100)
Start-Sleep -Seconds 3
} Until (($Jobs | Where State -eq "Running").Count -eq 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment