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

  Switch on low bandwidth view
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.

Defining an Idle Trigger

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

A 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 setting can be used to define how the Task Scheduler handles the task when the computer enters an idle state.

The following illustration provides a timeline that shows how these different idle conditions relate to each other. Be aware that the illustration starts when the task trigger is activated or when the task is started on demand.

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.

The Task Scheduler service will verify that the computer is in an idle state every 15 minutes. The computer is considered idle if there is 0% CPU usage and 0% disk input or output for 90% of the past 15 minutes and if there is no keyboard or mouse input during this period of time. 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.

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 triggers by setting the properties in the IIdleSettings and IIdleTrigger interfaces. An idle trigger will only trigger a task action if the computer enters an idle state after the start boundary of the trigger.

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 an idle condition, 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: 10/29/2008

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