{"id":1887,"date":"2014-03-02T11:59:00","date_gmt":"2014-03-02T11:59:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2014\/03\/02\/powertip-control-job-starts-with-powershell\/"},"modified":"2014-03-02T11:59:00","modified_gmt":"2014-03-02T11:59:00","slug":"powertip-control-job-starts-with-powershell","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/powertip-control-job-starts-with-powershell\/","title":{"rendered":"PowerTip: Control Job Starts with PowerShell"},"content":{"rendered":"<p><b>Summary<\/b>: Learn how to use Windows PowerShell to control which jobs start when.\n<img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Question\">&nbsp;How can I use Windows PowerShell to complete a group of jobs before I start more jobs? &nbsp;<\/p>\n<p style=\"margin-left:30px\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Answer\">&nbsp;Use the&nbsp;<b>Start-Job&nbsp;<\/b>cmdlet, for example, to start 3 long running processes:<\/p>\n<p style=\"margin-left:120px\">Start-Job {&lt;long running process 1&gt;}<\/p>\n<p style=\"margin-left:120px\">Start-Job {&lt;long running process 2&gt;}<\/p>\n<p style=\"margin-left:120px\">Start-Job {&lt;long running process 3&gt;}<\/p>\n<p style=\"margin-left:60px\">Then use&nbsp;<b>Wait-Job<\/b>&nbsp;to stop further processing. It works at the prompt, or even better, in a script:<\/p>\n<p style=\"margin-left:120px\">Get-Job | Wait-Job<\/p>\n<p style=\"margin-left:60px\">After your jobs have completed, you can run more jobs:<\/p>\n<p style=\"margin-left:120px\">Start-Job {&lt;long running process 4&gt;}<\/p>\n<p style=\"margin-left:120px\">Start-Job {&lt;long running process 5&gt;}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Learn how to use Windows PowerShell to control which jobs start when. &nbsp;How can I use Windows PowerShell to complete a group of jobs before I start more jobs? &nbsp; &nbsp;Use the&nbsp;Start-Job&nbsp;cmdlet, for example, to start 3 long running processes: Start-Job {&lt;long running process 1&gt;} Start-Job {&lt;long running process 2&gt;} Start-Job {&lt;long running process [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[193,189,4,45],"class_list":["post-1887","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-background-jobs","tag-richard-siddaway","tag-scripting-techniques","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Learn how to use Windows PowerShell to control which jobs start when. &nbsp;How can I use Windows PowerShell to complete a group of jobs before I start more jobs? &nbsp; &nbsp;Use the&nbsp;Start-Job&nbsp;cmdlet, for example, to start 3 long running processes: Start-Job {&lt;long running process 1&gt;} Start-Job {&lt;long running process 2&gt;} Start-Job {&lt;long running process [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/1887","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=1887"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/1887\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=1887"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=1887"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=1887"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}