If you are new to Windows administration or to PowerShell, little things like getting a .PS1 script to run in Task Scheduler can be quite frustrating.

As you can see in the screenshot below, it is easy to set a .PS1 file to automatically run:

how to schedule a powershell script to run in task scheduler
  1. Launch Task Scheduler
  2. Expand Task Scheduler Library
  3. Right click on the background and select CREATE NEW TASK (or select it from the ACTIONS pane on the right)
  4. On the GENERAL TAB, enter whatever task name and description you want
  5. On the GENERAL TAB, you will likely want to click CHANGE USER OR GROUP button (middle right) and have the job run as someone else
    • like a service account you created in Active Directory just for this task
    • note the you can use the SYSTEM account for many tasks but after you set it to run as SYSTEM you can not longer change the task because you don’t know the password
  6. On the TRIGGERS tab, click the NEW button and set whatever trigger you want, most commonly a time of day
  7. On the ACTIONS tab, click NEW and:
  8. On the CONDITIONS tab, set as you please but often unselecting all options
  9. On the SETTINGS tab you likely want to configure it to run
    1. ON DEMAND (so you can right click on it and force it to run anytime you want)
    2. IF THE TASK FAILS, RESTART EVERY whatever you want
    3. STOP THE TASK IF IT RUNS LONGER THAN whatever you want
how to schedule a powershell script to run in task scheduler - tabs


Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *