PowerTip: Control Job Starts with PowerShell

PowerTip: Control Job Starts with PowerShell

  • Comments 3
  • Likes

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>}

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment