Scheduling Scripts On Windows 10

The Task Scheduler application allows automating power shell scripts. This guide will show you the steps to create and schedule your first script.

Scheduling Scripts On Windows 10

Steps to create a power shell task:

  1. Go to Start and search for Task Scheduler and open it.

  2. Click the Action -> Create Task from the menu bar. image.png

  3. Give a suitable name and an optional description for this task. image.png The Security Options section can be used to configure which administrator account can run the task.

  4. In order to run a power shell script without the command window from showing up, we need to select the option Run whether user is logged on or not in the Security Options as shown above.

  5. Now navigate to the Triggers tab -> and select the New button. image.png Select action to be a program

    • The Begin the task option can be used to set at what event the task must execute (If it were to start on system log on, based on a schedule or when the system gets locked/unlocked).
    • The Settings section (Outlined green) allows one to set the time on which the task must be run. A task can be set to run on a given time, or can be set to run daily, weekly on specific days or even several days on every given month.
    • The Advanced settings section (Outlined Cyan) allows one to set the frequency of running tasks, restrictions on when to stop the task and even an expiry rule for the task.
  6. Now navigate to the Actions tab -> and select the New button. image.png In the Program/script field mention the path to the powershell.exe. You can add the complete path to the actual power shell script to the Add arguments field.

  7. The Conditions tabs can be used to set more specific conditions apart from the trigger, to determine whether the task should run. The task will not run if any condition specified in this tab is not true.

  8. And the Settings tab can be used to specify any other additional behavior of the task such as when to delay, repeat, stop, and expire the task. (Usually, I don't change these settings unless necessary)

  9. Click on the OK button to save the task.

Steps to enable, disable, edit and delete a task:

  1. Go to Start and search for Task Scheduler and open it.

  2. To enable or disable a task, right click on the task from the list of tasks and click on either Enable/Disable option from there.

  3. To edit the task, right click on the task from the list of tasks and click on Properties option from there. This will open up the task window and you can change the task properties there.

  4. To Delete a task, right click on the task from the list of tasks and click on Delete option from there.

And that's about it folks, you have scheduled your first power shell script. Although this guide is focused on scheduling power shell scripts in Windows 10, the same should work with older versions of Windows that have the task scheduler.