Home » How To » How To Run a PowerShell Script on Schedule With Task Scheduler

How To Run a PowerShell Script on Schedule With Task Scheduler

Have a script that needs to run at a specific time? You can use the task scheduler to launch the PowerShell script on a schedule.

Previously, I’ve shown you how to open a webpage or URL on schedule using the Task Scheduler. One of the windowsloop readers recently emailed me asking how to run the PowerShell script on a schedule. Since the task scheduler is very versatile and can launch almost anything, you can run the PowerShell script on schedule with the Task Scheduler. What’s more, it is pretty helpful and straightforward too.

For instance, I have a custom PowerShell script that checks for all available Windows updates and lists their KB (knowledge base) number, name, and download size. Generally, I used to execute the script as and when needed manually. i.e., almost daily. However, I don’t have to run the script manually by scheduling the PowerShell script to launch at the system log on. That is one less thing I need to do every day.

So, let me show you how to launch a PowerShell script on schedule using the Task Scheduler.

Note: I assume that you already have a PowerShell script to schedule and set an acceptable execution policy to execute PowerShell scripts. The steps shown will work in Windows 10 and 11.

Schedule PowerShell Script with Task Scheduler

Here are the steps to schedule a PowerShell script with Task Scheduler in Windows 10 and 11.

  1. Open the Task Scheduler from the Start menu.
  2. Click the “Create Basic Task” option.
  3. Name the new scheduled task and click “Next.”
  4. Choose “When I log on” and click “Next.”
  5. Choose the “Start a program” option and click “Next.”
  6. Type the below path in the “Program/Script field.”
  7. Type the script path in the “Add arguments” field.
  8. Click “Next.”
  9. Click “Finish.”
  10. With that, you have scheduled a PowerShell script.

Same steps with a bit more detail and screenshots:

1. First, search for the task scheduler in the Start menu and open it. You can also use the taskschd.msc command in the Run dialog box to open the task scheduler.

Open task scheduler from start menu

2. After opening the task scheduler, click on the “Create Basic Task” option appearing under the Task Scheduler Library section on the right panel.

Schedule powershell script 01

3. The above action will open the scheduled task creation wizard. Type in a proper name and description and click on the “Next” button. A good name and description will help you quickly identify the task in the list.

Schedule powershell script 02

4. Here, select when you’d like to start the script. In my case, I want the script to begin as soon as I log into the system. So, I selected the “When I log on” option. Once you choose the appropriate option, hit the “Next” button.

Schedule powershell script 03

5. To run PowerShell scripts, we need to use the PowerShell program. So, select the “Start a program” option and click on the “Next” button.

Schedule powershell script 04

6. In the “Program/Script” field, enter the PowerShell executable path. You can use the below path as the PowerShell executable path. In the “Add arguments” field, type the PowerShell script path. For instance, I’ve stored my PowerShell script in the root of the D drive. So, I’ve entered “D:\hello_world.ps1” in the arguments field. Click the “Next” button to continue.

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Schedule powershell script 05

7. Task scheduler will now show a preview of all your settings. Go through them, and once you are satisfied, click on the “Finish” button to save the task.

Schedule powershell script 06

8. That is all. You’ve created a scheduled task to launch a PowerShell script. To test if the task is working as it should, find the task in the list, right-click on it and select the “Run” option.

Schedule powershell script 07

9. If everything goes right, you should see the PowerShell script running. In my case, I’m running a simple hello world script that waits for user input to close. As you can see, it runs perfectly fine.

Schedule powershell script 08

That is all. It is that simple to schedule a PowerShell script in Windows 10.

Leave a Comment

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

Scroll to Top