Click to Rate and Give Feedback
MSDN
MSDN Library
Windows Development
Task Scheduler
 Task Idle Conditions
Task Idle Conditions

A task can be handled in several ways when the computer enters an idle state. This includes defining an idle trigger or setting the idle conditions for when the task starts.

Detecting the Idle State

The Task Scheduler service will verify that the computer is in an idle state every 15 minutes.

The computer is considered idle if all the processors and all the disks were idle for more than 90% of the past 15 minutes and if there is no keyboard or mouse input during this period of time. Besides, any presentation type application that sets the ES_DISPLAY_REQUIRED flag will make Task Scheduler to not consider the system as being idle.

In Windows 7, Task Scheduler considers a processor as idle even when low priority threads (thread priority < normal) execute.

When the Task Scheduler service detects that the computer is idle, the service only waits for user input to mark the end of the idle state.

Defining an Idle Trigger

A task can be started when the computer enters an idle state by defining an idle trigger.

An idle trigger will only trigger a task action if the computer enters an idle state after the start boundary of the trigger.

An application can define an idle trigger by using the IIdleTrigger interface.

If reading or writing XML, the idle trigger is specified by the IdleTrigger element of the Task Scheduler schema.

Task Settings for Idle Conditions

The task settings can be used to define how the Task Scheduler handles the task when the computer enters an idle state.

The following illustrations provide three possible timelines that show how these different idle conditions relate to each other. Be aware that the illustrations start when the task trigger is activated or when the task is started on demand (without requesting to ignore the exisitng task contraints).

Idle condition timeline

The following list describes the idle conditions:

  • Idle Wait: The amount of time that the Task Scheduler will wait for an idle state to occur after a task trigger is activated or after the task is started on demand.
  • Idle Duration: The amount of time you want the computer to have been idle before starting the task.
  • Idle Start: The time when the computer enters an idle state.
  • Idle End: The time when the computer goes out of the idle state. Be aware that the amount of time the computer is in the idle state is independent of the idle duration time that was described previously.

For example, 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.

By default, a task DisallowStartIfOnBatteries property is set to true, which means the Task Scheduler service will not run tasks that are triggered by an idle trigger (or a trigger with idle conditions) when a computer is running on battery power. You can change this behavior by setting the DisallowStartIfOnBatteries property to false.

If a task is triggered by an idle trigger, then the WaitTimeout property of the IIdleSettings interface (IdleSettings for scripting) is ignored.

Applications can control the idle conditions by setting the properties in the IIdleSettings and IIdleTrigger interfaces.

If reading or writing XML, these conditions are specified in the Settings element of the Task Scheduler schema.

Cycling Idle Condition

If the computer is cycling in and out of the idle state, you can terminate and restart the task using the following idle conditions. To terminate and restart a task, both properties and elements must be set to True:

  • To terminate the task when the idle condition ends, set the StopOnIdleEnd property or the StopOnIdleEnd element to True.
  • To restart the task when the computer cycles into the idle condition again, set the RestartOnIdle property or the RestartOnIdle element to True.

 

 

Send comments about this topic to Microsoft

Build date: 2/7/2012

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker