Partager via


Task Conditions

Applies To: Windows Server 2008, Windows Vista

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.