SharePoint Views

Schedule Powershell Script to run on a windows server using Task Scheduler

Here are the steps to Schedule Powershell Script to run on a schedule in any windows Server.

1. Open Windows Task scheduler from Administrative tools.
2. Right click on Task Scheduler Library and Select Create a task.
3. UnderĀ General tab, Enter the name of the task and update Security options.Task scheduler
4. Click on Change User or Group button to run the task as a different user or service account. If the task is scheduled to run as different user other than logged in user, password for that other account should be entered at the end.
5. Select Triggers tab, click New to add a new trigger for scheduling the task.Update day and time settings for the job to run.Task Scheduler - Triggers tab
6. Next, select Actions tab, click New to select the action to be performed by this task.Task scheduler - Actions tab
7. Select Start a Program in Action drop-down. Select PowerShell for Program/Script option. (C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe)schedule powershell script to run on windows server
Next, in Add arguments box, enter the name of your script along with location/path. Example: C:\Scripts\myscript.ps1
8. In Conditions and Settings tab, make any desired changes and click ‘OK’.
9. At this point, if you have selected to run the script with any other account other than currently logged in account, you will be prompted for password here.