PowerTip: Control Job Starts with PowerShell

Doctor Scripto

Summary: Learn how to use Windows PowerShell to control which jobs start when. Hey, Scripting Guy! Question How can I use Windows PowerShell to complete a group of jobs before I start more jobs?  

Hey, Scripting Guy! Answer Use the Start-Job cmdlet, for example, to start 3 long running processes:

Start-Job {<long running process 1>}

Start-Job {<long running process 2>}

Start-Job {<long running process 3>}

Then use Wait-Job to stop further processing. It works at the prompt, or even better, in a script:

Get-Job | Wait-Job

After your jobs have completed, you can run more jobs:

Start-Job {<long running process 4>}

Start-Job {<long running process 5>}

0 comments

Discussion is closed.

Feedback usabilla icon