Posted On May 6, 2022

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

kimconnect 0 comments
blog.KimConnect.com >> Codes , Windows >> 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 *

Related Post

PowerShell: Delete Hidden System Volume Information Directory

# Incident:The System Volume Information has been copied over to an SMB share, where such…

PowerShell Script to Send Email

Use this newer method: https://blog.kimconnect.com/powershell-script-to-send-emails/ ### Variables section ###$fromaddress = "[email protected]"$toaddress = "[email protected]"$bccaddress = ""$CCaddress…

Where to Put JavaScript Codes?

Most often, JavaScript is placed between the <head> and </head> section. However, that may not…