Using the Task Scheduler

This section contains code examples that illustrate how the Task Scheduler API is used and XML examples that show how tasks are defined in the Task Scheduler schema. Most of these examples are stand-alone code that can be run independently, or pasted into a larger application and modified to the requirements of the application.

The following table lists Task Scheduler 2.0 examples included in this section.

Example Description
Starting an Executable at a Specific Time Defines a task that starts Notepad at a specified time.
Starting an Executable Daily Defines a task that starts Notepad daily.
Starting an Executable on System Boot Defines a task that starts Notepad when the system is booted.
Starting an Executable Weekly Defines a task that starts Notepad on a weekly basis.
Starting an Executable When a Task is Registered Defines a task that starts Notepad when the task is registered.
Starting an Executable When a User Logs On Defines a task that starts Notepad when a user logs on.
Enumerating Tasks and Displaying Task Information Enumerates through all the tasks on the local computer and displays each task's state.

 

The following table lists Task Scheduler 1.0 examples included in this section.

Example Description
Creating a Task Using NewWorkItem Example Creates a new task.
Enumerating Tasks Example Enumerates all the tasks on the local computer.
Starting a Task Example Starts a known task.
Editing a Work Item using Property Pages Displays the property pages of a task for editing.
Retrieving Work Item Property Examples A set of examples that show how to retrieve properties that apply to all types of work items.
Setting Work Item Property Examples A set of examples that show how to set properties that apply to all types of work items.
Retrieving Task Property Examples A set of examples that show how to retrieve properties unique to tasks.
Setting Task Property Examples A set of examples that show how to set properties unique to tasks.
Retrieving a Task Page Example Retrieves and displays the general task page of a known task.
Creating a New Trigger Creates a new trigger for a known task.
Creating an Idle Trigger Example Creates an event-based idle trigger for a known task.
Terminating a Task Example Terminates a task while it is running.
Retrieving Trigger Strings Example Retrieves the trigger string of all triggers associated with a known task.

 

Task Scheduler

About The Task Scheduler