Windows Vista User Guide
windows vista user guideWindows Vista User GuideWindows Vista User Guide UpgradeWindows Vista User Guide Get StartedWindows Vista User Guide TipsWindows Vista User Guide AboutWindows Vista User Guide ContactWindows Vista User Guide VideosWindows Vista User Guide Books
Task Scheduler
You can use Task scheduler to schedule various tasks to run at times that you may be away from the pc. these tasks include disk defragmentation tasks, which are actually automatically included in the scheduled tasks lists now to ensure that the disk always gets defragmented.
If you click on display all running taks, you can see the window above, that shows you a list of some running tasks already started by the pc. These are usually system tasks but can include those that you have scheduled if they are running at the time. You can also end tasks from this list by selecting the task and clicking End Task.
In the main scheduled task window, you can see this list which shows you a list of tasks that have started in a certain time period. The default time period is 24 hours, however this can be changed easily by clicking on the drop down box and selecting the partocular time frame you wish to see. This is useful to see which tasks have run properly and which have not, You can also see any tasks that you may not have wanted running wthin those time frames. Below is the last 30 days, as you can see if you doubleclick on the cross, a list of instances of that task will appear with the times they ran and the run result.
You can also see any hidden tasks by clicking on the View link on the right and selecting view hidden tasks, these are mainly system tasks that run without any need for user interaction and may be crucial for starting up drivers and running automatic backup operations.
How Tos
Triggers
When setting up a task, first decide what will trigger that task to start. A trigger is a set of criteria that, when met, starts the execution of a task. A task's triggers are displayed on the Triggers tab of the Task Properties or Create Task dialog box. You can use a time-based trigger or an event-based trigger to start a task. Time-based triggers include starting a task at a specific time of day or starting a task multiple times on a daily, weekly, or monthly schedule. Event-based triggers start a task in response to certain system events. For example, event-based triggers can be set to start a task when the system starts up, when a user logs on to the computer, or when the computer enters an idle state. Each task can contain one or more triggers, allowing the task to be started in many ways. If a task has multiple triggers, the task will start when any of the triggers occur.

Trigger Settings
Each trigger contains settings that determine the criteria to activate the trigger. Additional advanced settings can be set for each trigger, which is explained in the Advanced Settings section below. The trigger settings are accessed from the Edit Trigger or New Trigger dialog box, which is viewed by clicking on the Edit or New button on the Triggers tab in the Task Properties or Create Task dialog box. For more information about how to change trigger settings, see Change an Existing Task or Schedule a Task.

Triggers
The following list describes each trigger and the trigger settings.

On a schedule

This trigger causes the task to run according to a schedule, and the trigger settings allow you to set the schedule. You can choose to schedule the task at one time, or on a daily, weekly, or monthly schedule. The time you set is relative to the time zone that is set on the computer that runs the task. Check the Universal check box to make the time relative to Coordinated Universal Time (UTC) instead of the time zone that is set on the computer that runs the task. Use the Universal setting when you want to coordinate a set of tasks to run simultaneously in multiple time zones.

If you select the One time radio button, you choose a date and time to trigger the task.

If you select the Daily radio button, you choose the recurrence interval for the task and the date and time to start the task. An interval of 1 produces a daily schedule and an interval of 2 produces an every other day schedule. The task will start at the specified time each day.

If you select the Weekly radio button, you choose the recurrence interval for the task, the date and time to start the task, and the days of the week in which to start the task. An interval of 1 produces a weekly schedule and an interval of 2 produces an every other week schedule. The task will start at the specified time on each of the specified days.

If you select the Monthly radio button, you choose the months in which you want to start the task and the weeks of the month and the days of the week for each month in which you want to start the task. You can also specify that you want to start a task on the last day of each month.

At log on

This trigger causes the task to run when a user logs on to the computer, and the trigger's settings allow you to specify that the task should be triggered when any user logs on the computer or when a specific user or user group member logs on.

At startup

This trigger causes the task to run when the computer starts up. The only settings for this trigger are the advanced settings described in the Advanced Settings section below.

On idle

This trigger causes the task to run after the computer enters an idle state, and the idle settings can be set from the Conditions tab in the Create Task or Task Properties dialog box. For more information, see Task Conditions.

On an event

This trigger causes the task to run when specific event entries are added to an event log. You can choose between specifying basic event trigger settings or custom event trigger settings. If you choose the basic event trigger settings, a single event from a specific event log will trigger the task. You choose the event log that contains the event, the event publisher name, and specify the event identifier. If you choose the custom event trigger settings, you can specify an XML event query or a custom event filter to query for events that will trigger the task. For more information about event filters, see Create a Custom View.

Note
This trigger is not available for tasks configured for Windows Server 2003, Windows XP, or Windows 2000.

At task creation/modification

This trigger causes a task to run as soon as it is created and when the task is modified. The only settings for this trigger are the advanced settings described in the Advanced Settings section below.

Note
This trigger is not available for tasks configured for Windows Server 2003, Windows XP, or Windows 2000.

On connection to user session

This trigger causes a task to run when a user session is connected to from the local computer or from a remote desktop connection. For example, when you connect to a user session on the local computer by switching users on the computer, this trigger will cause the task to run. Another example that can trigger a task to run is when a user connects to a user session by using the Remote Desktop Connection program from a remote computer. The trigger's settings allow you to specify that the task should be triggered when any user connects to a user session or when a specific user or user group member connects.

Note
This trigger is not available for tasks that are configured for Windows Server 2003, Windows XP, or Windows 2000.

On disconnect from user session

This trigger causes a task to run when a user session is disconnected from the local computer or from a remote desktop connection. For example, when you disconnect from a user session on the local computer by switching users on the computer, this trigger will cause the task to run. Another example that can trigger a task to run is when a user disconnects from a user session by using the Remote Desktop Connection program from a remote computer. The trigger's settings allow you to specify that the task should be triggered when any user disconnects from a user session or when a specific user or user group member disconnects.

Note
This trigger is not available for tasks configured for Windows Server 2003, Windows XP, or Windows 2000.

On workstation lock

This trigger causes the task to run when the computer is locked. The trigger's settings allow you to specify that the task should be triggered when any user locks the computer or when a specific user or user group member locks the computer.

Note
This trigger is not available for tasks configured for Windows Server 2003, Windows XP, or Windows 2000.

On workstation unlock

This trigger causes the task to run when the computer is unlocked. The trigger's settings allow you to specify that the task should be triggered when any user locks the computer or when a specific user or user group member locks the computer.

Note
This trigger is not available for tasks configured for Windows Server 2003, Windows XP, or Windows 2000.

Advanced Settings
The following list describes the advanced trigger settings.

Delay task for or Delay task for up to (random delay): This setting allows you to specify an amount of time to delay the task from running, after the task is triggered. If you are using a time-based trigger (On a schedule), then the delay time will be a random time between the time the task is triggered and the time specified in this setting. If a task is scheduled to be triggered at 1:00 pm, and the Delay task for up to (random delay) setting is set to 5 minutes, then the task will run sometime between 1:00 pm and 1:05 pm.

Repeat task every: This setting allows you to set a repetition time interval for the task. The task will run, wait for the time interval specified, and then run again. This cycle will continue until the duration time is met.

Stop any task that runs longer than: This setting allows you to stop long running tasks by setting a time limit on the amount of time the task is allowed to run (execute the action).

Activate: This setting allows you to set a date and time to activate the trigger. Once a trigger is activated, the trigger can cause the task to run. The time is relative to the time zone that is set on the computer that runs the task. Check the Universal check box to make the time relative to Coordinated Universal Time (UTC) instead of the time zone that is set on the computer that runs the task. Use the Universal setting when you want to coordinate a set of tasks to activate simultaneously in multiple time zones.

Expire: This setting allows you to set a date and time for the trigger to expire. When a trigger is expired, it can not cause the task to run. The time is relative to the time zone that is set on the computer that runs the task. Check the Universal check box to make the time relative to Coordinated Universal Time (UTC) instead of the time zone that is set on the computer that runs the task. Use the Universal setting when you want to coordinate a set of tasks to expire simultaneously in multiple time zones.

Enabled: This setting allows you to enable or disable the task. A task that is enabled can run, and a task that is disabled cannot run until it is enabled.

Actions
A task action is the work that is performed when the task is run. A task can have a single action or a maximum of 32 actions. Each action contains settings that determine how the action is performed. A task's actions are displayed on the Actions tab of the Task Properties or Create Task dialog box. When multiple actions are specified, they are executed in sequential order starting with the action at the top of the list in the Actions tab and ending with the action at the bottom of the list. You can change the order in which the actions are executed by selecting an action and clicking on the up or down arrow button to move the action in the list.

The following list contains a description of each action and the action settings.

Start a program

This action starts a program or script. In the Program/script text box, enter the name of the program or script you want to start. If the program or script takes command line arguments, you can supply these arguments in the Add arguments (optional) text box. In the Start in (optional) text box, you can specify the working directory for the command line that executes the program or script. This should be either the path to the program or script file or the path to the files that are used by the executable file.

Send an e-mail

This action sends an e-mail when a task is triggered. In the action settings you specify the e-mail address that the e-mail is from, the e-mail address that the mail will be sent to, the subject of the e-mail, the text in the e-mail message, and optional e-mail attachments. You must also specify the SMTP server that you use to send e-mail from.

Note
This action is not available for tasks configured for Windows Server 2003, Windows XP, or Windows 2000.

Display a message

This action shows a message box with a specified message and title. The action settings specify the text for the message box title and the text in the message. This action will only launch if the Run only if user is logged on security option is selected in the General tab of the Task Properties or Create Task dialog box.

Note
This action is not available for tasks configured for Windows Server 2003, Windows XP, or Windows 2000.

Starting a program
If an action starts a program when a task is triggered, then you need to enter the name of the program or script and the command-line arguments needed to run the program or script. The following list contains commonly used programs that an action can run. To display more information about each program and the available arguments for each program, type the program name followed by /? at a command prompt.

Note
A program might require elevated privileges to run correctly. For information about how to specify the security context for a task, see Task Security Context.


Name (Localizable) Program/script Arguments
Run a script
cscript.exe

Note
To run a script, you can specify the name of the script file with no arguments instead of specifying cscript.exe, and the default script host is used to run the script.

<script file>

Copy a file
robocopy
<source file> <destination file>

Start a service
net
start <service name>

Stop a service
net
stop <service name>

Shut down
shutdown
-s

Restart
shutdown
-r

Log off
shutdown
-l

Disk cleanup
cleanmgr
/sagerun

Defragment a disk
defrag
<drive letter>

Check a disk
chkdsk
<drive letter>

Map a drive
net
use <drive letter> <network path>

Connect to a dial-up network
rasdial
<entry name>

Disconnect from a dial-up network
rasdial
<entry name> /disconnect

Archive an event log
wevtutil

Note
This program is not available on operating systems prior to Windows Vista.

al <log path>

Display a web page
iexplore

Note
This program should be started from the "%ProgramFiles%\Internet Explorer" directory.

<URL>

Play something
wmplayer

Note
This program should be started from the "%ProgramFiles%\Windows Media Player" directory.

Task Conditions
Conditions control whether a task is run. A task will run if all of its conditions are met after the task is triggered to start. Conditions are split up into three categories: idle conditions, power conditions, and network conditions. A task's conditions are displayed on the Conditions tab of the Task Properties or Create Task dialog box.

Idle Conditions
You can set a condition that tells the task to run only if the computer is in an idle state for a specific amount of time when a trigger is activated. When you set this condition, you also set the amount of time to wait (after the task is triggered) for the computer to enter an idle state.

The Task Scheduler service will check if the computer is in an idle state every 15 minutes. A computer is considered to be in an idle state when a screen saver is running. If a screen saver is not running, then the computer is considered to be in an idle state if there is 0% CPU usage and 0% disk input or output for 90% of the past fifteen minutes and if there is no keyboard or mouse input during this period of time. Once the Task Scheduler service detects that the computer is in an idle state, the service only waits for user input to mark the end of the idle state.

If a task is set to start only if the computer is idle for 30 minutes, and the task waits for the computer to be idle for 10 minutes, then the task will launch in 5 minutes only if the computer has been idle for 25 minutes prior to the time the trigger was activated. The task will not start if the computer enters an idle state 5 minutes after the trigger is activated.

If the Stop if the computer ceases to be idle condition is selected for a task and the task is running while the computer is in an idle state, then the task will stop running when the computer ceases to be idle. The task that is stopped by this condition will start running again the next time the computer enters an idle state if the Restart if idle state resumes condition is selected.

Power Conditions
You can set a condition that tells the task to run only if the computer is on AC power (not battery power) when the task trigger is activated. If this condition is set, you can also set a condition to stop the task if the computer switches to battery power. If both of these conditions are set for a task, then you have ensured that the task will only run when the computer is on AC power.

You can also set a condition that tells the task to wake the computer from sleep mode to run the task when the trigger is activated. Before you set the condition to wake the computer to run the task, ensure that the task will not cause the computer to wake at inconvenient times.

Note
When the Task Scheduler service wakes, the computer to run a task, the screen may remain off even though the computer is no longer in the sleep or hibernate mode. The screen will turn on when Windows detects that a user has returned to use the computer.

Network Conditions
You can set a condition to run the task only if a specific named network connection is available or if any network connection is available when the task's trigger is activated. If your task action requires a network connection to execute, then set this condition.

Note
This condition is not available for tasks configured for Windows Server 2003, Windows XP, or Windows 2000.

 

Task Settings
Task settings specify how a task is run, stopped, or deleted. A task's settings are displayed on the Settings tab of the Task Properties or Create Task dialog box. The following list contains the descriptions of task settings.

Allow task to be run on demand

You can specify whether a task can be run manually before or after it is scheduled to run by allowing the task to be run on demand. The default setting allows a user to run the task at any time on demand. For more information about how to run a task on demand, see Run a Task on Demand.

Note
This setting is not available for tasks configured for Windows 2003, Windows XP, or Windows 2000.

Run task as soon as possible after a scheduled start is missed

If this setting is checked, the Task Scheduler service will start the task if the task was scheduled to run at a certain time, but for some reason (for example, the computer was turned off or the Task Scheduler service was busy) the task was not activated. The Task Scheduler service will not start the task immediately after the task was missed. By default the service waits ten minutes before starting the missed task.

Note
This setting is not available for tasks configured for Windows 2003, Windows XP, or Windows 2000.

If task fails, restart every: <time period>

Use this setting to restart a task if the task fails to run (the last run result of the task is not a success). You specify the time interval that takes place between task restart attempts, and the number of times to try to restart the task.

Note
This setting is not available for tasks configured for Windows 2003, Windows XP, or Windows 2000.

Stop the task if it runs longer than: <time period>

This setting allows you to limit the amount of time a task is allowed to run. Use this setting to limit tasks that might take a long period of time to execute, causing an inconvenience to the user.

If the task does not end when requested, force it to stop

If this setting is selected, the task will be forced to stop if the task does not respond to a request to stop.

Note
This setting is not available for tasks configured for Windows 2003, Windows XP, or Windows 2000.

If the task is not scheduled to run again, delete it after: <time period>

If this setting is selected, the Task Scheduler service will automatically delete the task if it is not scheduled to run again. The Task Scheduler service will wait for the specified time period before deleting the task. If this setting is not selected, the Task Scheduler service will not automatically delete the task. The task must include at least one trigger with an expiration date in order to select this setting.

If the task is already running, then the following rule applies:

You must specify how the Task Scheduler service should run the task if another instance of the task is already running:

Do not start a new instance: The Task Scheduler service will not run the new instance of the task and will not stop the instance that is already running.

Run a new instance in parallel: The Task Scheduler service will run the new instance of the task in parallel with the instance that is already running.

Queue a new instance: The Task Scheduler service will add the new instance of the task to the queue of tasks that the service will run, and the service will not stop the instance of the task that is already running.

Stop the existing instance: The Task Scheduler service will stop the instance of the task that is already running, and run the new instance of the task.

Note
This setting's value is Do not start a new instance for tasks configured for Windows 2003, Windows XP, or Windows 2000.

You can start the Task Scheduler MMC snap-in by using a single command from the command line or by using the Windows interface. Task Scheduler can also be started by double-clicking the Taskschd.msc file in the %SYSTEMROOT%\System32 folder.

To Run Task Scheduler using the Windows interface

Click the Start button.

Click Control Panel.

Click System and Maintenance.

Click Administrative Tools.

Double-click Task Scheduler.

To Run Task Scheduler from the Command Line

Open a command prompt. To open a command prompt, click Start, click All Programs, click Accessories, and then click Command Prompt.

At the command prompt, type Taskschd.msc.

The Schtasks.exe command line tool enables a user to complete many of the same operations that they can complete using the Task Scheduler MMC snap-in. This tool enables a user to create, delete, query, change, run, and end scheduled tasks on a local or remote computer. This tool is located in the %SYSTEMROOT%\System32 folder. Type Schtasks.exe /? from a command prompt window to view the help for the tool.

 

Schedule a Task
You can schedule a task by either creating a basic task using the Create Basic Task Wizard or by creating a task without the wizard and supplying task information in the Create Task dialog box. The procedures below describe how to create a task using either method. If you create a basic task using the Create Basic Task Wizard, most of the task properties will be set to their default values, and you choose a trigger for the task from the most commonly used triggers. For more information about triggers, see Triggers.

You can import a task that is defined in an XML file. For more information, see Import a Task.

For information on creating a task on a remote computer, see Manage or Create a Task on a Remote Computer.

Scheduling a Task
Using the Windows interface

Using a command line

To create a basic task by using the Windows interface

If Task Scheduler is not open, start Task Scheduler. For more information, see Start Task Scheduler.

Find and click the task folder in the console tree that you want to create the task in. For more information about how to create the task in a new task folder, see Create a New Task Folder.

In the Actions Pane, click Create Basic Task.

Follow the instructions in the Create Basic Task Wizard.

To create a task by using the Windows interface

If Task Scheduler is not open, start Task Scheduler. For more information, see Start Task Scheduler.

Find and click the task folder in the console tree that you want to create the task in. If you want to create the task in a new task folder, see Create a New Task Folder to create the folder.

In the Actions Pane, click Create Task.

On the General tab of the Create Task dialog box, enter a name for the task. Fill in or change any of the other properties on the General tab. For more information about these properties, see General Task Properties.

On the Triggers tab of the Create Task dialog box, click the New… button to create a trigger for the task, and supply information about the trigger in the New Trigger dialog box. For more information about triggers, see Triggers.

On the Actions tab of the Create Task dialog box, click the New… button to create an action for the task, and supply information about the action in the New Action dialog box. For more information about actions, see Actions.

(Optional) On the Conditions tab of the Create Task dialog box, supply conditions for the task. For more information about the conditions, see Task Conditions.

(Optional) On the Settings tab of the Create Task dialog box, change the settings for the task. For more information about the settings, see Task Settings.

Click the OK button on the Create Task dialog box.

To create a task by using a command line

Open a command prompt. To open a command prompt, click Start, click All Programs, click Accessories, and then click Command Prompt.

Type:

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]
To view the help for this command, type:

schtasks /Create /?

 

 

Change an Existing Task
You can change an existing task by changing the general properties, triggers, actions, conditions, or settings of the task. For more information about deleting a task, see Delete a Task.

Changing an Existing Task
Using the Windows interface

Using a command line

To change an existing task by using the Windows interface

If Task Scheduler is not open, start Task Scheduler. For more information, see Start Task Scheduler.

Find and click the task folder in the console tree that contains the task you want to change.

In the console window, click the task that you want to change.

Click Properties in the Action pane. The Task Properties dialog box will appear.

In the Task Properties dialog box:

Click the General tab to view the task's general properties that you can change. For more information about these properties, see General Task Properties.

Click the Triggers tab to view the task's triggers. Select a trigger from the list of triggers on the tab and click the Edit button to change the selected trigger's settings, click the New button to create a new trigger, or click the Delete button to delete the selected trigger. For more information about triggers, see Triggers.

Click the Actions tab to view the task's actions. Select an action from the list of actions on the tab and click the Edit button to change the selected action's settings, click the New button to create a new action, or click the Delete button to delete the selected action. For more information about actions, see Actions.

Click the Conditions tab to view the task's conditions that you can change. For more information about these conditions, see Task Conditions.

Click the Settings tab to view the task's settings that you can change. For more information about these settings, see Task Settings.

Click the OK button on the Task Properties dialog box when you are finished changing the task.

To change an existing task by using a command line

Open a command prompt. To open a command prompt, click Start, click All Programs, click Accessories, and then click Command Prompt.

Type:

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] }
To view the help for this command, type:

schtasks /Change /?

 

Delete a Task
You can delete a task from a task folder when you no longer want to run the task. To stop a task from running for a certain time, but you do not want to permanently delete the task, you can disable the task. For more information, see Disable a Task from Running.

To delete a task by using the Windows interface

If Task Scheduler is not open, start Task Scheduler. For more information, see Start Task Scheduler.

Find and click the task folder in the console tree that contains the task to delete.

In the console window, click the task to delete.

In the Actions pane, click Delete.

In the Confirm delete dialog box, click Yes.

To delete a task by using a command line

Open a command prompt. To open a command prompt, click Start, click All Programs, click Accessories, and then click Command Prompt.

Type:

schtasks /Delete [/S <system> [/U <username> [/P [<password>]]]]
/TN <taskname> [/F]
To view the help for this command, type:

schtasks /Delete /?

 

Create a New Task Folder
You can create a new task folder to store related tasks and other task folders. You cannot rename a task folder once it is created. For information about deleting a task folder, see Delete a Task Folder.

For information about creating a task in a task folder, see Schedule a Task.

To create a new folder to store related tasks by using the Windows interface

If Task Scheduler is not open, start Task Scheduler. For more information, see Start Task Scheduler.

Find and click the task folder in the console tree that you want to create a folder under. For example, if you want to create a sub-folder in the root task folder, click the Task Scheduler Library folder.

In the Actions pane, click New Folder.

In the Enter name of the new folder dialog box, type the name of folder.

Click the OK button in the Enter name of the new folder dialog box.

 

Import a Task
You can import a task, which will add the imported task to a task folder and allow you to use and run the task. A task's properties, triggers, actions, conditions, and settings are represented in an XML file. A task's XML is defined by the Task Scheduler Schema. To see an example of the XML that represents a task, export a task and view the saved XML file. For more information about exporting tasks, see Export a Task.

To import a task by using the Windows interface

If Task Scheduler is not open, start Task Scheduler. For more information, see Start Task Scheduler.

Find and click the task folder in the console tree in which you want to import the task. To import the task in a new task folder, see Create a New Task Folder to create the folder.

In the Actions Pane, click Import Task.

The Open dialog box will appear. Find the task XML file that you want to import and click the Open button.

The Create Task dialog box will appear. The General, Triggers, Actions, Conditions, and Settings tabs in the Create Task dialog box all contain the information from the imported task.

Click the OK button on the Create Task dialog box.

To import a task by using a command line

Open a command prompt. To open a command prompt, click Start, click All Programs, click Accessories, and then click Command Prompt.

Type:

schtasks /Create [/S <system> [/U <username> [/P [<password>]]]]
/XML <xmlfile> /TN <taskname>
To view the help for this command, type:

schtasks /Create /?

 

Export a Task
You can export a task so that the task is stored in an XML file which can be imported by other users and computers. A task's properties, triggers, actions, conditions, and settings are represented in an XML file. A task's XML is defined by the Task Scheduler Schema. For more information about importing tasks, see Import a Task.

To export a task by using the Windows interface

If Task Scheduler is not open, start Task Scheduler. For more information, see Start Task Scheduler.

Find and click the task folder in the console tree that contains the task you want to export.

In the console window, click the task that you want to export.

In the Actions pane, click Export…. The Save As dialog box will appear.

In the Save As dialog box, browse to the location that you want to save the task, and click the Save button.

To export a task by using a command line

Open a command prompt. To open a command prompt, click Start, click All Programs, click Accessories, and then click Command Prompt.

Type:

schtasks /Query [/S <system> [/U <username> [/P [<password>]]]]
/XML /TN <taskname>
The XML for the task is shown in the command prompt. Copy the XML for the task and paste it into a blank XML file. When the XML file is saved, the file will contain the task definition and can be imported.

To view the help for this command, type:

schtasks /Query /?

 

Run a Task on Demand
You can run a task before or after it is scheduled to run. This allows you to start the task's actions on demand. You must have the correct permissions to run certain tasks. For more information, see Task Security Context. You can only run a task on demand if the task is enabled and the Allow task to be run on demand setting is selected for the task. For information about enabling a task, see Enable a Task to Run. For more information about task settings, see Task Settings.

To run a task on demand by using the Windows interface

If Task Scheduler is not open, start Task Scheduler. For more information, see Start Task Scheduler.

Find and click the task folder in the console tree that contains the task you want to run.

In the console window, click the task that you want to run.

In the Actions pane, click Run.

To run a task on demand by using a command line

Open a command prompt. To open a command prompt, click Start, click All Programs, click Accessories, and then click Command Prompt.

Type:

schtasks /Run [/S <system> [/U <username> [/P [<password>]]]] /TN <taskname>
To view the help for this command, type:

schtasks /Run /?

 

End a Running Task
You can end a running task to stop the task from completing its actions. This stops the task while the task is in the process of completing an action. Only tasks with the If the running task does not stop when requested, force it to stop setting selected will be forced to end if they do not stop when you try to end them. For more information about settings, see Task Settings.

You must have the correct permissions to end certain tasks. For more information, see Task Security Context.

To end a running task by using the Windows interface

If Task Scheduler is not open, start Task Scheduler. For more information, see Start Task Scheduler.

Find and click the task folder in the console tree that contains the task you want to end.

In the console window, click the task that you want to end.

In the Actions pane, click End.

In the Confirm ending this task dialog box, click Yes.

Note
You can also end a task by clicking Display All Running Tasks… in the Actions pane, selecting a task in the Running Tasks dialog box, and then clicking on the End Task button in the Running Tasks dialog box.

To end a running task by using a command line

Open a command prompt. To open a command prompt, click Start, click All Programs, click Accessories, and then click Command Prompt.

Type:

schtasks /End [/S <system> [/U <username> [/P [<password>]]]] /TN taskname
To view the help for this command, type:

schtasks /End /?

 

Enable a Task to Run
When a task is disabled, which stops a task from running, you can enable the task so that it can be run on demand or when it is scheduled to run.

To enable a task to run by using the Windows interface

If Task Scheduler is not open, start Task Scheduler. For more information, see Start Task Scheduler.

Find and click the task folder in the console tree that contains the task you want to enable.

In the console window, click the task that you want to enable.

In the Actions pane, click Enable. The Enable command will only be available in the Actions pane if the task is disabled.

To enable a task to run by using a command line

Open a command prompt. To open a command prompt, click Start, click All Programs, click Accessories, and then click Command Prompt.

Type:

schtasks /Change [/S <system> [/U <username> [/P [<password>]]]]
/TN <taskname> [/ENABLE]
To view the help for this command, type:

schtasks /Change /?

 

Disable a Task from Running
If you want to stop a task from running for a certain period of time, you can disable the task. The task can be enabled at a later time so that it is allowed to run. For more information, see Enable a Task to Run.

To disable a task from running by using the Windows interface

If Task Scheduler is not open, start Task Scheduler. For more information, see Start Task Scheduler.

Find and click the task folder in the console tree that contains the task you want to disable.

In the console window, click the task that you want to disable.

In the Actions pane, click Disable. The Disable command will only be available in the Actions pane if the task is enabled.

To disable a task from running by using a command line

Open a command prompt. To open a command prompt, click Start, click All Programs, click Accessories, and then click Command Prompt.

Type:

schtasks /Change [/S <system> [/U <username> [/P [<password>]]]]
/TN <taskname> /DISABLE
To view the help for this command, type:

schtasks /Change /?

 

Manage or Create a Task on a Remote Computer
You can create or manage tasks on a remote computer by using the Task Scheduler user interface to connect to a remote computer. You must supply the name or IP address of the computer you want to connect to. You can connect to remote computers running Windows Vista, Windows Server 2003, Windows XP, or Windows 2000, and then, when connected, create or manage tasks on the remote computer in the same way you would create or manage tasks on the local computer. The user credentials that you use to connect to the remote computer must be a member of the Administrators group on the remote computer.

If you are to connecting to a remote Windows Vista computer from a Windows Vista computer, you need to allow the Remote Scheduled Tasks Management firewall exception on the remote computer. To allow this exception click Start, Control Panel, Security, Allow a program through Windows Firewall, and then select the Remote Scheduled Tasks Management check box. Then click the Ok button in the Windows Firewall Settings dialog box.

If you are connecting to a remote Windows XP or Windows Server 2003 computer from a Windows Vista computer, you need to allow the File and Printer Sharing firewall exception on the remote computer. To allow this exception click Start, Control Panel, double-click Windows Firewall, select the Exceptions tab, and then select the File and Printer Sharing firewall exception. Then click the Ok button in the Windows Firewall dialog box.

Managing or Creating a Task on a Remote Computer
Using the Windows interface

Using a command line

To create or manage a task on a remote computer by using the Windows interface

If Task Scheduler is not open, start Task Scheduler. For more information, see Start Task Scheduler.

Ensure that the Task Scheduler node is selected in the console tree. In the Actions pane, click Connect to Another Computer. The Select Computer dialog box will appear.

In the Select Computer dialog box, click the Another Computer radio button.

Enter the name or IP address of the remote computer in the text box next to the Another Computer radio button or click the Browse button to browse for a remote computer.

(Optional) You can connect to the remote computer using different credentials than the credentials for the current user. Click on the Connect as another user check box and then click the Set User button. Enter the user name and password of the user credentials that you want to use.

When a remote computer is specified, click the OK button on the Select Computer dialog box.

You are now connected to the remote computer. You can create or manage tasks (run, end, enable, disable, create, delete, view, import, and export tasks) on the remote computer using the same procedures that you would use if Task Scheduler were connected to the local computer. For more information about how to create or manage a task, see Task Scheduler How To....

To create or manage a task on a remote computer by using the command line

Open a command prompt. To open a command prompt, click Start, click All Programs, click Accessories, and then click Command Prompt.

Use the Schtasks.exe tool to manage or create a task, and specify the name or IP address of the remote computer you want to connect to in the /S system argument, the user name used to connect to the remote computer in the /U username argument, and the password for the username in the /P password argument. For help using Schtasks.exe, type one of the following commands:

schtasks /Create /?

schtasks /Run /?

schtasks /End /?

schtasks /Delete /?

schtasks /Change /?

 

Display all Running Tasks
You can display all the running tasks on a computer in the Running Task dialog box, which allows you to view when each running task started, how long each task has been running, and the action that each task is running. You can also end a running task from the Running Task dialog box.

To display all running tasks by using the Windows interface

If Task Scheduler is not open, start Task Scheduler. For more information, see Start Task Scheduler.

In the Actions pane, click Display All Running Tasks…. The Running Task dialog box will appear.

 

 

View Task Properties and History
A task's properties can be viewed to find out information such as the task's name, description, security options, triggers, actions, conditions, and settings. A task's history can also be viewed along with the properties. A task's history is tracked by events in the Microsoft-Windows-TaskScheduler event log. Events are raised when a task is started, run, when the task is finished executing, and at other times to track a task's history. Errors related to a task are also tracked in the task's history. For information about interpreting the events in task history, see Event Properties (http://go.microsoft.com/fwlink/?LinkId=70217).

To view a task's properties and history by using the Windows interface

If Task Scheduler is not open, start Task Scheduler. For more information, see Start Task Scheduler.

Find and click the task folder in the console tree that contains the task you want to view.

In the console window, click the task that you want to view.

Click Properties in the Action pane. The Task Properties dialog box will appear.

In the Task Properties dialog box, the task's properties are located on the General, Triggers, Actions, Conditions, and Settings tabs. Click a tab to view the properties.

Click the History tab to view the task's history. Click an event in the list of events on the History tab to view the description of the event.

To view a task's properties and history by using a command line

Open a command prompt. To open a command prompt, click Start, click All Programs, click Accessories, and then click Command Prompt.

Type:

Schtasks /Query /FO LIST /V

To view the help for this command, type:

schtasks /Query /?