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.


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


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


  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.


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


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


  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.


  19. Click OK.