SharePoint: How To Configure Scripts to Run Automatically in Task Scheduler

  1. Logon to the Windows 2008 R2 Server as Administrator.
  2. Navigate to Control Panel.
  3. Double-click on Administrative Tools.
  4. Double-click on Server Manager.

    2012-03-21-ConfigScriptsRunAuto-01.png

  5. Right-click on Task Scheduler, and click on Create Task.

    2012-03-21-ConfigScriptsRunAuto-02.png

  6. In the General Tab, type a preferred name of the script.

    2012-03-21-ConfigScriptsRunAuto-03.png

  7. In the Description field, type in the required description.
  8. Click the radio button Run whether user is logged on or not, so it is selected.
  9. Click the Triggers tab.

    2012-03-21-ConfigScriptsRunAuto-04.png

  10. Schedule the task as per the requirement.
  11. Click OK.
  12. Click Actions tab.

    2012-03-21-ConfigScriptsRunAuto-05.png

  13. Copy and paste the following line in Program/Script field.

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

  14. Copy and paste the following line in Add arguments(optional) field.
    • NoLogo -NonInteractive -File "F:\location of the script\Script Name.ps1"
  15. NOTE:
    • Replace the location of the Script with the exact location where the script is located.
    • Replace the Script Name.ps1 with the name of the script file.
  16. Click OK.
  17. Click on the Settings tab.
  18. Click the check box Stop the task if it runs longer than, so it is unchecked.

    2012-03-21-ConfigScriptsRunAuto-06.png

  19. Click OK.

https://www.nothingbutsharepoint.com/sites/devwiki/articles/Pages/SharePoint-How-To-Configure-Scripts-to-Run-Automatically-in-Task-Scheduler.aspx

Advertisements