Scheduling Background Jobs in Windows PowerShell 3.0

One of the most common phone calls that the support team gets for Windows PowerShell is “How do I use Task Scheduler to schedule Windows PowerShell scripts?”. As an administrator, you need to have full control over when scripts run in your environment. Perhaps you need run a script only during a one-off maintenance window or maybe you want to schedule some routine maintenance on a server so that it runs at non-peak times. Although it was possible to use Task Scheduler to invoke scripts in Windows PowerShell 2.0, it was not trivial. What’s more, you were responsible for writing code to store the detailed results of your script if you wanted to view them later.

In Windows PowerShell 2.0, we introduced background jobs, which let you run commands asynchronously in the background. This allows you to get the prompt back and continue running commands at the command line while the background job runs. In keeping with our sacred vow to respect your investment in learning Windows PowerShell by reusing concepts, we reused jobs in many places with Windows PowerShell 3.0. This blog post introduces just one example of this: job scheduling. This feature allows administrators to schedule background jobs for execution at a later time or according to a particular schedule with a set of cmdlets right out of the box. One of the most valuable features of scheduled jobs in Windows PowerShell 3.0 is that we’ll even take care of storing the results and output of your job.

Read more at source: Scheduling Background Jobs in Windows PowerShell 3.0


Anderson Patricio
Twitter: @apatricio

Leave a Comment

Your email address will not be published.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top