PowerShell PowerShell Background Jobs Basic job management

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

Get a list of all jobs in the current session:

Get-Job

Waiting on a job to finish before getting the result:

$job | Wait-job | Receive-Job 

Timeout a job if it runs too long (10 seconds in this example)

$job | Wait-job -Timeout 10

Stopping a job (completes all tasks that are pending in that job queue before ending):

$job | Stop-Job 

Remove job from current session's background jobs list:

$job | Remove-Job

Note: The following will only work on Workflow Jobs.

Suspend a Workflow Job (Pause):

$job | Suspend-Job 

Resume a Workflow Job:

$job | Resume-Job 


Got any PowerShell Question?