Author Topic: Use SchTasks.exe to Create and Manage Tasks  (Read 2599 times)

0 Members and 1 Guest are viewing this topic.

Use SchTasks.exe to Create and Manage Tasks
« on: June 16, 2010, 01:43:26 PM »

Offline Nick

  • Administrator
  • Platinum Member
  • *
  • Posts: 46028
  • Karma: +1000/-0
  • Gender: Male
  • NickCS
    • http://www.facebook.com/nickcomputerservices
    • http://www.twitter.com/nickcomputer
    • Computer Chiangmai

Use SchTasks.exe to Create and Manage Tasks

Learn how you can use a command-line interface to create, delete, query, change, run, and end scheduled tasks on a local or remote system.

The Schtasks.exe command-line interface utility allows an administrator to create, delete, query, change, run, and end scheduled tasks on a local or remote system through the command shell. Here’s an overview of its syntax and parameters.


Command Syntax
The SchTasks.exe command interface uses the following syntax:

SCHTASKS /<parameter> [arguments]

Command Parameters
The available parameters for SchTasks.exe are as follows:

/Create Creates a new scheduled task
/Delete Deletes the scheduled task(s)
/Query Displays all scheduled tasks
/Change Changes the properties of the scheduled task
/Run Runs the scheduled task immediately
/End Stops the currently running scheduled task
/? Displays a help message



Creating Tasks
The general syntax for Schtasks.exe is as follows:

SCHTASKS /Create [/S system [/U <username> [/P [<password>]]]] [/RU <username> [/RP <password>]] /SC schedule [/MO <modifier>] [/D <day>] [/M <months>] [/I <idletime>] /TN <taskname> /TR <taskrun> [/ST <starttime>] [/RI <interval>] [ {/ET <endtime> | /DU <duration>} [/K] [/XML <xmlfile>] [/V1]] [/SD <startdate>] [/ED <enddate>] [/IT] [/Z] [/F]


The following is an example command:

SCHTASKS /Create /S system /U user /P password /RU runasuser /RP runaspassword /SC HOURLY /TN rtest1 /TR notepad


Deleting Tasks
The general syntax for deleting a task is as follows:

SCHTASKS /Delete [/S <system> [/U <username> [/P [<password>]]]] /TN <taskname> [/F]


The following is an example command:

SCHTASKS /Delete /TN "Backup and Restore”


Running Tasks
The general syntax for running a task is as follows:

SCHTASKS /Run [/S <system> [/U <username> [/P [<password>]]]] /TN <taskname>


The following is an example command:

SCHTASKS /Run /TN "Start Backup"


Ending Tasks
The general syntax for ending a task is as follows:

SCHTASKS /End [/S <system> [/U <username> [/P [<password>]]]] /TN <taskname>


The following is an example command:

SCHTASKS /End /TN "Start Backup"


Querying Tasks
The general syntax for querying a task is as follows:

SCHTASKS /Query [/S <system> [/U <username> [/P [<password>]]]] [/FO <format>] [/NH] [/V] [/?]


The following is an example command:

SCHTASKS /Query /S system /U user /P password SCHTASKS /Query /FO LIST /V


Changing Tasks
The general syntax for changing a task is as follows:

SCHTASKS /Change [/S <system> [/U <username> [/P [<password>]]]] /TN <taskname> { [/RU <runasuser>] [/RP <runaspassword>] [/tr <taskrun>] [/ST <starttime>] [/RI <interval>] [ {/ET <endtime> | /DU <duration>} [/K]] [/SD <startdate>] [/ED <enddate>] [/ENABLE | /DISABLE] [/IT] [/Z] }


The following is an example command:

SCHTASKS /Change /RP password /TN "Backup and Restore"


From the Microsoft Press book The Windows 7 Resource Kit by Mitch Tulloch, Tony Northrup, Jerry Honeycutt, Ed Wilson, and the Windows 7 Team at Microsoft.

credit: technet.microsoft.com


 
Share this topic...
In a forum
(BBCode)
In a site/blog
(HTML)


Related Topics

  Subject / Started by Replies Last post
0 Replies
3440 Views
Last post February 16, 2009, 06:44:35 PM
by Webmaster
0 Replies
2625 Views
Last post August 24, 2009, 11:13:25 AM
by IT
0 Replies
4520 Views
Last post June 11, 2010, 04:44:53 PM
by Nick
0 Replies
4070 Views
Last post June 16, 2010, 02:10:11 PM
by Nick
0 Replies
2638 Views
Last post June 16, 2010, 06:03:20 PM
by Nick
0 Replies
3250 Views
Last post June 16, 2010, 06:04:49 PM
by Nick
0 Replies
3628 Views
Last post June 16, 2010, 07:14:52 PM
by Nick
0 Replies
4027 Views
Last post June 16, 2010, 09:24:15 PM
by Nick
0 Replies
1382 Views
Last post December 14, 2015, 09:40:41 PM
by pollokkaz
0 Replies
321 Views
Last post October 14, 2024, 06:24:58 PM
by rezrezmore