Schedule SharePoint powershell script using Task Scheduler

I needed to schedule a SharePoint powershell script. This is how I managed to do this. This blog explained the basic steps.  http://blog.avtex.com/2012/01/10/scheduling-powershell-scripts-with-sharepoint-2010/

Start Task Scheduler

Start –> Administrative Tools –> Task Scheduler

Action –> Create Task

image

I needeed to have the schedule run weather the user was logged in or not. Also I need to change the user running the script.

Switch to the action tab –> New Action, Choose “Start a program”

In program script

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

Add arguments

-psconsolefile "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\psconsole.psc1" -command "Path to your script"

image

When done add an appropriate Trigger to schedule your task. Here I have added a trigger to run daily

image

DONE Smile Combined with my previous blog "Using powershell to send emails" his can be combined to a good alert and simple mechanism.