How To Create a Windows Scheduled Task to Call a Program or Script

Example on How To Call a Program:
  1. Set Action = Start a Program
  2. Set Program/Script = C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe (must specify the full path of PowerShell in Windows)
  3. Set Arguments = -Command "& 'C:\Windows\system32\ping.exe' -n 1 google.com"
  4. Set Start-in = C:\Windows\system32 (or where ever the executable resides)
  5. If program would require Administrator context, don’t forget to set task to run with elevated permissions

Example on How To Call a PowerShell Script:
  1. Set Action = Start a Program
  2. Set Program/Script = C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe (must specify the full path of PowerShell in Windows)
  3. Set Arguments = -Command "& 'C:\Scripts\deleteLogsOlderThanXDays.ps1'"
  4. Set Start-in = C:\Scripts (or where ever the script resides)
  5. If program would require Administrator context, don’t forget to set task to run with elevated permissions

Leave a Reply

Your email address will not be published. Required fields are marked *