Steps to Create Schedule Task to Run Powershell script
1. Open the Windows Task Scheduler : Go to > Start > Administrative Tools and select Task Scheduler.
4. In the Task Scheduler, select the Create Task… option under the Actions menu.
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.
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.
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”
11. That’s all, we completed the new schedule task configuration and click OK to complete process.
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.