Powershell commands

View the current list of scheduled tasks


For a full list of supported parameters

schtasks.exe /?

Create a new scheduled task

schtasks /Create /?
schtasks /Create /SC ONSTART /TN MyTaskName /TR "some command to exectute or path to a batchfile"

Run as Administrator:

schtasks /Create /SC ONSTART /TN MyTaskName /TR "some command to exectute or path to a batchfile" /RU SYSTEM
Delete scheduled task

schtasks /Delete /TN MyTaskName
Displays scheduled tasks

schtasks /Query
schtasks /Query /TN MyTaskName
Change the properties of scheduled task

schtasks /Change /?
Run scheduled task on demand

schtasks /Run /TN MyTaskName
Stop currently running scheduled task

schtasks /End

Adding a task to to the OS task scheduler

schtasks is in System32 if it's not already in your path.

schtasks can be run either on startup, timed, or as a one off execution

Full paths are needed in schtasks.


schtasks /Create /SC ONSTART /TN TimeSync /TR "w32tm /resync"

This forces a time re-sync.  You could replace the /TR with a script rather than a direct command.

Triggering running of a batch file

Batch files need to be ANSI not Unicode.

Testing powershell script when run through powershell command line can have errors and still complete, but when running as script file from task scheduler can "shells out" and stop when reaching an error in the file, so ensure you include error handling if needed.

Full paths are needed in schtasks.

We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.


Your email address will not be published.