Triggers

Applies To: Windows Server 2008, Windows Vista

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