Scheduling SharePoint PowerShell Scripts in Windows Server 2008 R2

In order to schedule a SharePoint PowerShell script to be run on specific time in Windows Server 2008 R2, perform the following procedures.

  1. Save your PowerShell script into some folder location with .ps1 extension.
  2. Create a new task in Windows task scheduler. Specify the user account the PowerShell script to use when running.
  3. In Actions, add  new action of type “Start Program”. In the Program/Script section, provide full path of “PowerShell.exe” file. That is, “C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe”.
  4. In the Add Arguments field, it needs two arguments. One is the path to SharePoint Administration Console file and the other is the path to your PowerShell script file. This can be provided as follows:
    • -PSConsoleFile "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\psconsole.psc1" -Command " & ‘<folder path>\<your script file>.ps1’ "
  5. The “Start in” optional filed has to be provided as the folder location where your script resides if your script uses current folder for getting resources files or saving log files.
  6. Set other necessary options such as Triggers, Conditions etc. and save the task.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s