Task Scheduler Overview

The Task Scheduler MMC snap-in helps you schedule automated tasks that perform actions at a specific time or when a certain event occurs. It maintains a library of all scheduled tasks, providing an organized view of the tasks and a convenient point of access for managing them. From within the library, you can run, disable, modify, and delete tasks. The Task Scheduler user interface (UI) is an MMC snap-in that replaces the Scheduled Tasks Explorer extension in Windows XP, Windows Server 2003, and Windows 2000. For more information about starting or accessing the Task Scheduler UI, see Start Task Scheduler.

Triggers and Actions

The two key concepts involved in scheduling a task are triggers and actions. A trigger causes a task to run and an action is the work that is performed when the task is run. The actions a task can perform include running a program, sending an e-mail message, and showing a message box. For example, you can send an e-mail when a certain event entry is logged in the event log or run a maintenance script when a user logs on to a computer. Occurrences that can trigger a task to run include: a computer starting up, a computer entering an idle state, or a user unlocking a workstation. In addition, you can schedule a task to run at a specified time.

For more information about Triggers and Actions see:

  • Triggers

  • Actions

Additional references

Task Scheduler How To...

Troubleshooting Task Scheduler

General Task Properties


General Task Properties

The general properties of a task are displayed on the General tab of the Task Properties or Create Task dialog box. The general properties of a task include the task name, author, description, security options, the operating system that the task is configured for, and a property that controls whether the task is hidden.

When you create a task in a task folder, you must name the task. No two tasks can have the same name if they are in the same task folder. The task description is optional.

Task security options specify the security context that the task runs under. For more information, see Task Security Context.

By default, hidden tasks are not shown in the Task Scheduler user interface. You can view hidden tasks when Show Hidden Tasks is selected in the View menu. You make a task hidden when you click the Hidden check box on the General tab of the Task Properties or Create Task dialog box.

Task Configuration

Tasks configured for Windows Vista® or Windows Server® 2008 have more functionality than the tasks configured for down-level systems (Windows Server 2003, Windows XP, or Windows 2000), and because of this, tasks configured for Windows Vista or Windows Server 2008 will not work on down-level systems. Tasks configured for down-level systems will work on Windows Vista or Windows Server 2008, but certain triggers, actions, conditions, and settings are only available on Windows Vista or Windows Server 2008. Tasks configured for down-level systems do not display, in the Task Scheduler console window, the date and time that the tasks were created. For more information about triggers available for each operating system, see Triggers, and for information about actions available for each operating system, see Actions.

If a task is created on a computer running Windows Vista or Windows Server 2008, and the task needs to be managed from a remote down-level system (Windows Server 2003, Windows XP, or Windows 2000), then configure the task for down-level systems. Otherwise, the task should be configured for Windows Vista or Windows Server 2008.

Additional references

Triggers

Actions

Task Conditions

Task Settings


Task Security Context

A scheduled task, by default, runs within the security context of the user who scheduled the task and only runs if that user is logged on when the task is triggered. To modify this, change the settings in the Security options section of the General tab when a task's properties are displayed.

You can select a different user or group account for a task to run under by clicking the Change User or Group button. The button will be titled Change User if your user account is not a member of the Administrators group. User accounts that are not in the Administrators group can only specify a user account for a task to run under.

Note

If a task is registered using the Administrators group for the security context of the task, then you must also make sure the Run with highest privileges check box is checked if you want to run the task.

You can specify that a task should run even if the account under which the task is scheduled to run is not logged on when the task is triggered. To do this, select the radio button labeled Run whether user is logged on or not. If this radio button is selected, tasks will not run interactively. To make a task run interactively, select the Run only when user is logged on radio button.

When the Run whether user is logged on or not option if selected, you may be prompted to supply the credentials of the account when saving the task, regardless of whether you select the checkbox labeled Do not store password or not. If the account is not logged on when the corresponding task is triggered, the service will use the saved credentials to run as the specified account and will have unconstrained use of the resulting token.

If you select the checkbox labeled Do not store password, Task Scheduler will not store the credentials supplied on the local computer, but will discard them after properly authenticating the user. When required to run the task, the Task Scheduler service will use the “Service-for-User” (S4U) extensions to the Kerberos authentication protocol to retrieve the user’s token.

When using S4U the ability of the service to use the security context of the account is constrained. In particular, the service can only use the security context to access local resources.

Notes
  • If your task requires access to network resources, you cannot use S4U; doing so will cause your task to fail. The only exception is the case where constrained delegation was established between the computers involved in the operation.
  • S4U functionality is only available within an environment where all the domain controllers (DCs) in the domain are running the Windows Server 2003 or later operating system.
  • If you are using the S4U functionality, the task will not have access to encrypted files.

If you are using the S4U functionality, make sure the Logon as batch job policy is set for the user. This policy is accessible by opening the Control Panel, Administrative Tools, and then Local Security Policy. In the Local Security Policy window, click Local Policy, User Rights Assignment, and then Logon as batch job.

For more information about the S4U Kerberos extensions, see RFC 1510.

If you select the checkbox labeled Run with highest privileges, Task Scheduler will run the task using an elevated privileges token rather than a least privileges (UAC) token. Only tasks that require elevated privileges to complete their actions should run with elevated privileges. For more information, see User Account Control.


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.

Additional references

Schedule a Task


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>

Additional references

Triggers


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.

Additional references

Schedule a Task

Change an Existing Task


Task Scheduler How To...

The topics in the following list contain information and step-by-step procedures that explain how to use the Task Scheduler user interface or a command line to schedule and manage tasks.

  • Start Task Scheduler: Describes how to start the Task Scheduler MMC snap-in, and how to find the command line tool used to schedule and manage tasks (Schtasks.exe).

  • Schedule a Task: Describes how to schedule a task using the Create Task dialog, using the Create Basic Task Wizard, or by using a command line.

  • Manage Tasks: Links to topics that describe how to manage tasks. For example, change, run, stop, enable, or import a task.

  • Manage or Create a Task on a Remote Computer: Describes how to use the Task Scheduler user interface or a command line to connect to a remote computer and manage or create tasks on the remote computer.

  • Display all Running Tasks: Describes how to easily display all the running tasks on a computer.

  • View Task Properties and History: Describes how to display the Task Properties dialog box to view a task's history and properties.

Additional references

Troubleshooting Task Scheduler


Start Task Scheduler

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

  1. Click the Start button.

  2. Click Control Panel.

  3. Click System and Maintenance.

  4. Click Administrative Tools.

  5. Double-click Task Scheduler.
To Run Task Scheduler from the Command Line

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

  2. 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

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

  2. 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.

  3. In the Actions Pane, click Create Basic Task.

  4. Follow the instructions in the Create Basic Task Wizard.
To create a task by using the Windows interface

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

  2. 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.

  3. In the Actions Pane, click Create Task.

  4. 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.

  5. 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.

  6. 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.

  7. (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.

  8. (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.

  9. Click the OK button on the Create Task dialog box.
To create a task by using a command line

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

  2. 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 /?

Additional Considerations

  • If the Remote Scheduled Tasks Management exception is disabled and the File and Printer Sharing exception is enabled in the Windows Firewall Settings, and the Remote Registry service is running, a V1 task will be created on the remote computer even when the V1 parameter is not specified. The V1 parameter specifies that a task is visible to down-level systems.

Additional references

Manage or Create a Task on a Remote Computer

Command-line syntax notation


Manage Tasks

The following list includes topics that describe how to manage tasks by using the Windows interface or a command line.

  • Change an Existing Task

  • Delete a Task

  • Delete a Task Folder

  • Create a New Task Folder

  • Import a Task

  • Export a Task

  • Run a Task on Demand

  • End a Running Task

  • Enable a Task to Run

  • Disable a Task from Running


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

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

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

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

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

  5. In the Task Properties dialog box:

    1. 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.

    2. 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.

    3. 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.

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

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

  6. Click the OK button on the Task Properties dialog box when you are finished changing the task. This will register the task again. If the task has an action that is triggered when the task is registered, the action will be executed. If you have not made any changes to the task, click the Cancel button.
To change an existing task by using a command line

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

  2. 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 /?

Additional references

Delete a Task

Manage or Create a Task on a Remote Computer

Command-line syntax notation


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

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

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

  3. In the console window, click the task to delete.

  4. In the Actions pane, click Delete.

  5. In the Confirm delete dialog box, click Yes.
To delete a task by using a command line

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

  2. Type:

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

To view the help for this command, type:

schtasks /Delete /?

Additional references

Export a Task

Disable a Task from Running

Command-line syntax notation


Delete a Task Folder

You can delete a task folder that is used to store tasks if the task folder is empty. You must delete all the tasks and all the folders in a task folder before you can delete the task folder. You cannot delete the Task Scheduler Library folder because it is the root task folder. You cannot rename task folders. For more information about deleting tasks in a task folder, see Delete a Task.

To delete a task folder using the Windows interface

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

  2. Find and click the task folder in the console tree that you want to delete.

  3. In the Actions pane, click Delete Folder.

  4. In the Confirm delete dialog box, click Yes.


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

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

  2. 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.

  3. In the Actions pane, click New Folder.

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

  5. 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

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

  2. 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.

  3. In the Actions Pane, click Import Task.

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

  5. 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.

  6. Click the OK button on the Create Task dialog box.

To import a task by using a command line

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

  2. Type:

    schtasks /Create [/S <system> [/U <username> [/P [<password>]]]]
/XML <xmlfile> /TN <taskname>

To view the help for this command, type:

schtasks /Create /?

Additional references

Export a Task

Change an Existing Task

Command-line syntax notation


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

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

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

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

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

  5. 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

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

  2. Type:

    schtasks /Query [/S <system> [/U <username> [/P [<password>]]]]
/XML /TN <taskname>

  3. 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 /?

Additional references

Import a Task

Command-line syntax notation


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

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

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

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

  4. In the Actions pane, click Run.
To run a task on demand by using a command line

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

  2. Type:

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

To view the help for this command, type:

schtasks /Run /?

Additional references

End a Running Task

Display all Running Tasks

Command-line syntax notation


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

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

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

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

  4. In the Actions pane, click End.

  5. 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

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

  2. Type:

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

To view the help for this command, type:

schtasks /End /?

Additional references

Display all Running Tasks

Command-line syntax notation


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

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

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

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

  4. 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

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

  2. Type:

    schtasks /Change [/S <system> [/U <username> [/P [<password>]]]]
/TN <taskname> [/ENABLE]

To view the help for this command, type:

schtasks /Change /?

Additional references

Run a Task on Demand

Disable a Task from Running

Command-line syntax notation


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

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

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

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

  4. 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

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

  2. Type:

    schtasks /Change [/S <system> [/U <username> [/P [<password>]]]]
/TN <taskname> /DISABLE

To view the help for this command, type:

schtasks /Change /?

Additional references

Run a Task on Demand

Enable a Task to Run

Command-line syntax notation


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 Server® 2008, 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 connecting to a remote computer running Windows Vista or Windows Server 2008 from a computer running Windows Vista or Windows Server 2008, you need to enable 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 computer running Windows XP or Windows Server 2003 from a computer running Windows Vista or Windows Server 2008, 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

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

  2. 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.

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

  4. 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.

  5. (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.

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

  7. 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

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

  2. 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 /?

Additional references

Task Scheduler How To...

Manage Tasks

Command-line syntax notation


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

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

  2. 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

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

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

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

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

  5. 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.

  6. 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

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

  2. Type:

    Schtasks /Query /FO LIST /V

To view the help for this command, type:

schtasks /Query /?

Additional references

Change an Existing Task

General Task Properties

Triggers

Actions

Task Conditions

Task Settings


Configure AT Service Account Information

The at.exe executable schedules commands and programs to run on a computer at a specified time and date similar to Task Scheduler. Task Scheduler and the schtasks.exe executable replace at.exe. All tasks created using the at.exe executable must run under the same account. By default this account is the local system account, but you can change this by configuring the AT service account information.

To configure the AT service account information

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

  2. Click AT Service Account Configuration in the Action pane.

  3. In the AT Service Account Configuration dialog box, select Service Account or This Account to choose the account that will be used to run tasks scheduled with the at.exe executable. If you select, This Account then you must supply a password for the account.

  4. Click the Ok button in the AT Service Account Configuration dialog box.


Troubleshooting Task Scheduler

If you are having problems scheduling tasks or getting tasks to run correctly, first ensure that the Task Scheduler service is running. You can verify the service is running if you click the Start button, click Control Panel, click System and Maintenance, click Administrative Tools, and then click Services and verify that the Task Scheduler service's status is Started.

Note

The Task Scheduler service cannot be used while the computer is running in safe mode.

Updated troubleshooting information may be available online at Troubleshooting Task Scheduler.

For information about an event or error message related to Task Scheduler, see Events and Error Message Center.

A task does not run when you expect it to run

If a scheduled task does not run when you expect it to run, ensure that the task is enabled, and also check the triggers on the task to ensure that they are set correctly. For more information see, Enable a Task to Run. For more information about updating a task's triggers, see Change an Existing Task. Also, check the history of the task to see when the task was started and to check for errors. For more information, see View Task Properties and History.

A task will run only if all of the task's conditions are met. You can set a task's conditions on the Conditions tab of the Task Properties dialog box. For more information, see Task Conditions.

Some tasks will only run when a certain user is logged on, depending on a task's security options. If a scheduled task does not run when you expect it to run, ensure that the task's security options are set correctly. For more information, see Task Security Context and Change an Existing Task.

A task ran, but the program that should have been executed did not run correctly

If a task attempts to execute a program, but the program does not run correctly, first try running the program manually (not from a task) to ensure that the program works correctly. You might need to add command-line options to the path of the program. For more information, see Actions. If available, view the help for the program that you are trying to run.

Some programs require elevated privileges to run correctly. If a task is running a program that requires elevated privileges, ensure that the task runs with the highest privileges. You can set a task to run with the highest privileges by changing the task's security options on the General tab of the Task Properties dialog box.

If a task program does not run correctly, check the history of the task for errors. For more information, see View Task Properties and History.

An error occurs when a task attempts to send an e-mail

If a task attempts to send an e-mail, but the e-mail doesn't get sent correctly, first make sure that the settings for the e-mail action on the task are set correctly. The e-mail action must have a valid value for the SMTP server, To, and From settings. For more information about these settings, see Actions.

Make sure the SMTP server that sends the e-mail is setup correctly. E-mail is sent using NTLM authentication for Windows SMTP servers, which means that the security credentials used for running the task must also have privileges on the SMTP server to send e-mail. If the SMTP server is a non-Windows based server, then the e-mail will be sent if the server allows anonymous access. For information about setting up the SMTP server, see SMTP Server Setup, and for information about managing SMTP server settings, see SMTP Administration.

A task is using 100 percent of the CPU

A task can be scheduled that is triggered often enough to cause 100 percent of the CPU to be used. If this problem occurs, the system can become unusable.

To correct this problem, disable the task and then change the trigger for the task. For more information about how to change a task, see Change an Existing Task.

If the system is unresponsive because the task is using all of the system resources, perform the following steps:

  1. Restart the computer in safe mode (the Task Scheduler service does not run in safe mode),

  2. In the /Windows/System32/Tasks folder, rename the file for the task, or delete the file.

  3. Restart the system in normal mode and then redefine the task.


Command-line syntax notation

The following table describes the notation used to indicate command-line syntax.

Notation | Description
Text without brackets or braces | Items you must type as shown
<Text inside angle brackets> | Placeholder for which you must supply a value
[Text inside square brackets] | Optional items
{Text inside braces} | Set of required items; choose one
Vertical bar (|) | Separator for mutually exclusive items; choose one
Ellipsis (…) | Items that can be repeated