Scheduled Tasks in Windows from Command Line

Sep - 14 2022 | By

Note if you are admin of the remote system you do not need /U and /P.  If you need to assign a user to run this task other than the local user, use /RU <username> /RP <password> to store that login information with the task.

To create a task on a remote computer using a XML Export

schtasks /Create /S <name or TCP/IP Address of System> /U <username> /P <password> /XML <xmlfile> /TN <taskname>

Sample: schtasks /Create /S 10.10.10.10 /U admin /P password /XML \\server\share\sample.xml /TN NewTask
On computer you are at: schtasks /Create /XML \\server\share\sample.xml /TN NewTask

For more information on creating tasks – https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks-create

Run a scheduled task on a remote computer

schtasks /Run /S <name or TCP/IP Address of System> /U <username> /P <password> /TN <taskname>

Sample: schtasks /Run /S 10.10.10.10 /U admin /P password /TN NewTask
On computer you are at: schtasks /Run /TN NewTask

For more information on running tasks – https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks-run

Delete a scheduled task on a remote computer

schtasks /Delete /S <name or TCP/IP Address of System> /U <username> /P <password> /TN <taskname>

Sample: schtasks /Delete /S 10.10.10.10 /U admin /P password /TN NewTask
On computer you are at: schtasks /Delete /TN NewTask

For more information on deleting tasks – https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks-delete

End a task that is running or paused on a remote computer

schtasks /End /S <name or TCP/IP Address of System> /U <username /P <password> /TN <taskname>

Sample schtasks /End /S 10.10.10.10 /TN NewTask
On computer you are at: schtasks /End /TN NewTask