About the Task SchedulerAbout the Task Scheduler*
*Contents  *Index  *Topic Contents
*Previous Topic: Task Scheduler API
*Next Topic: Programming the Task Scheduler

About the Task Scheduler

The Task Scheduler allows you to perform automated tasks on a chosen computer. The Task Scheduler monitors whatever criteria you choose and executes the task when the criteria for executing the task have been met. For example, you can have the computer run ScanDisk at 7:00 P.M. every Sunday.

arrowy.gifWhat Is a Task?

arrowy.gifWhat Is a Trigger?

arrowy.gifWhat Is an Idle Trigger?

arrowy.gifWhat Is a Scheduled Work Item?

What Is a Task?

A task is any object that the Task Scheduler can execute. These include any of the following (as supported by the operating system on which the task will execute): Win32® application, Win16 application, OS/2 application, MS-DOS® application, batch file (*.bat), command file (*.cmd), or any properly registered file type. A task has one or more triggers that determine when the task should be executed.

You use the ITask interface to control and modify tasks.

What Is a Trigger?

A trigger is a set of criteria that, when met, will activate and cause a task to be executed. There are two types of triggers: time-based and event-based.

Time-based triggers activate at a specified point in time. Not only can you set the time that they become active, but you can also have them activate once, daily, weekly, monthly, on a specified day of the month (the third day of the month), or on a specified day of the week of a month (the second Tuesday of the month).

Event-based triggers activate in response to certain system events. There are event-based triggers that become active when the system starts up, when a user logs on to the local computer, or when the system becomes idle. The last of these are known as idle triggers.

You use the ITaskTrigger interface to control and modify triggers.

What Is an Idle Trigger?

When no keyboard or mouse input occurs, the computer is considered to be in an idle state. An idle trigger is an event-based trigger that becomes active a specified amount of time after the computer becomes idle. When you set the idle-related flags for a task, you create an idle trigger. You use the IScheduledWorkItem::SetIdleWait method to set the amount of time that the system is idle before the task is executed. You can use the IScheduledWorkItem::GetIdleWait method to retrieve this same value. There are three idle-related flags that can be set on a given task: TASK_FLAG_START_ONLY_IF_IDLE, TASK_FLAG_KILL_ON_IDLE_END, and TASK_FLAG_RESTART_ON_IDLE_RESUME (see ITask::SetTaskFlags).

Note The Task Scheduler service that monitors triggers on Microsoft® Windows NT® does not monitor idle conditions and does not activate any idle triggers. This does not, however, affect the task itself. The TASK_EVENT_TRIGGER_ON_IDLE trigger type and the task idle time can be set and retrieved on Windows NT. The information associated with these triggers and flags is persistent. The only difference is that, on Windows NT, the idle trigger is never activated.

What Is a Scheduled Work Item?

A scheduled work item is an item that the Task Scheduler service runs at a time specified by the item's trigger(s). Currently the only type of scheduled work item is a task.

The IScheduledWorkItem interface contains methods that are supported by all types of scheduled work items. Tasks are manipulated using the ITask interface, which derives from IScheduledWorkItem.


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.