Run PowerShell script from Task Scheduler

We can easily execute commands from powershell command window whenever we want to do some task. But for regular task, it would be great if we run powershell script as Scheduled Task. You can create a scheduled task to run Powershell script using Windows Task Scheduler. Follow the below steps to create daily schedule to run a Powershell script file.

Steps to Create Schedule Task to Run Powershell script

1. Open the Windows Task Scheduler : Go to > Start > Administrative Tools and select Task Scheduler.

How to Schedule Powershell Script to run in Task Scheduler

4. In the Task Scheduler, select the Create Task… option under the Actions menu.

How to Schedule Powershell Script to run in Task Scheduler

5. Enter a name for the task, and give it a description (the description is optional and not required).
6. Under Security options section, you can specify different user account that the task should be run under and select the option ‘Run whether user logged on or not‘ so that the task will run even if the user is not logged.

Create Schedule Task to run Powershell Script

7. Then, select the Triggers tab, and click New to add a new trigger for the scheduled task. This new task should use the On a schedule option. The start date can be set to a desired time, and the frequency and duration of the task can be set based on your specific needs and click OK. Here, I have configured a daily schedule to run the Powershell script on daily basis.

Create Schedule Task to run Powershell Script

8. Then, go to the Actions tab and click New to set the action for this task to run. Set the Action to Start a program.
9. In the Program/script box enter Powershell
10. In the Add arguments (optional) box enter the complete script file path. For example, if your Powershell Script is named “test-script.ps1” and placed under “C:Scripts“. then you have to enter path like: “C:Scriptstest-script.ps1.ps1

Steps to Create Schedule Task to run Powershell Script

11. That’s all, we completed the new schedule task configuration and click OK to complete process.

Steps to Create Schedule Task to run Powershell Script

12. Under Task Scheduler Library, You can check daily task run status of your task and you can also run the task whenever you want by right-click on the task and click Run.

Steps to Create Schedule Task to run Powershell Script
Advertisement

Leave a Comment