Use the scheduler to automatically execute tasks

Source: Internet
Author: User
Tags repetition

Author: Ed Bott, Carl siechert, and Craig Stinson
(From Windows Vista inside out 2007 Microsoft Corporation. For more information about this book, visit Microsoft
Learning website .)

Perhaps in your opinion, the most important automation tool is the task scheduler. In the Windows Vista operating system, the task scheduler is significantly improved in terms of functionality and ease of use compared with Windows XP. This topic describes how to use the task scheduler to set events or schedules that you specify to trigger automated routines.
You can use task scheduler without advanced programming techniques. The following section describes how to use the Windows Vista Task Scheduler, create a task, set a task trigger, and set task operations.

Use the Windows Vista Task Scheduler

If you have used scheduled tasks in Windows XP, you will be delighted to see Windows Vista's improvements in this regard. First, the user interface of the task scheduler is implemented in the form of a Microsoft Management Console (MMC) snap-in, this allows you to access more information about the attributes, status, and running history of a task (as well as the content created by the operating system and your program.
For more information about MMC, see what is Microsoft Console
(MMC )?

Secondly, the "scheduled task" Management Unit is integrated into the "Event Viewer" Management Unit through a reasonable organizational layout, which makes it easier to use events (for example, an application crash or a "disk space is full" error occurs) as a task trigger. For more information about the event viewer Management Unit, see open event viewer.

Next, the most important thing is that the Windows Vista Task Scheduler supports a wider range of trigger and schedule options. Now, in addition to running programs or scripts at a specified time, you can also start the corresponding operations when the computer is idle for a certain period of time, specific user login or logout. You can use these (and other) triggers to send email messages or display message windows, and run programs or scripts.

To start the scheduler Management Unit, click Start, click control panel, and then click system and maintenance ".
Under administrative tools, click schedule task ". If the system prompts you to enter the administrator password or confirm the password, enter the password or confirm the password.

If the Start menu contains the Administrative Tools Folder, you can find the task scheduler in it ". Alternatively, press the Windows logo key + R on the keyboard, and then type taskschd. MSC in the "run" dialog box.
However, after issuing this command, you need to answer the prompt in the "User Account Control" (UAC) dialog box, and then the system will display the "Task Scheduler" Management Unit.

Displays the "Task Scheduler" in the default layout status ". As you can see, the window is vertically divided into three panes: the console tree on the left, the "operations" Pane on the right, and the pane that contains information areas in the middle. The console tree displays the computer you are currently operating on (local computer or connected network computer) and provides a folder Tree Containing the currently defined task. You can create your own folders here to organize your own tasks, or add new tasks to the existing folders.

The Operations pane lists the operations you can perform in the menu. The operation items listed here appear in the corresponding menu at the top of the window, with few exceptions. Therefore, if you feel the center pane is a bit crowded, consider hiding the "operation" pane. (To hide this pane, click View, click custom, and then clear the actions pane check box .)

Windows Vista Task Scheduler
Microsoft Management Console (MMC) Management Unit

At first, in the center pane, you will see a "Task Scheduler overview" message (this is static text; after reading, you can click the collapse arrow on the right to hide it), the status report of all tasks running for a period of time (the default is the last 24 hours) (in the "task status" Area) and the summary of all tasks currently started (in the "active task" area ). The entry in the "task status" list has an outline control. Click the plus sign of a project to view its details.

The "task status" and "active task" areas are not automatically updated. To view the latest information, click Refresh (this command is available in the bottom of the center pane, Operation pane, or operation menu ).

If this is your first visit to the task scheduler, you may be surprised by the number of active tasks that have been created for Windows and your program. For example, if you use the Windows Vista backup program to regularly perform full backup and Incremental backup, you will find backup-related items in the "active task" list. If you or other users do not disable the automatic disk fragment task, the list contains the corresponding items.
If you rely on Windows Calendar or other programs to remind you of the appointment time or task deadline, the "active task" list may display this function.

To view which tasks are being managed by the task scheduler, click show all running tasks in the actions pane ". (If you want to find this command in the "operations" menu, make sure to select the top node of the console tree .)
View the task and click Close ".

If you need to know what an activity task is doing and how it is set, you need to find the task in the console tree. Expand the entries in the console tree as needed, and then browse the corresponding projects. The console tree entries are displayed as visual folders. Each folder can contain several subfolders or one or more tasks.

After selecting a folder in the console tree, the central pane of the task scheduler is divided into two panes. The upper pane lists all tasks stored in the selected folder. At the same time, the lower pane displays the tab properties page that contains the currently selected task. Displays the windowsbackup folder in the console tree, the automaticbackup task in the upper pane, and the "General" attribute of the automaticbackup task in the lower pane. (The "operations" pane in this figure is hidden .)

After you select a folder in the console tree (in the upper pane), a list of tasks in the folder is displayed (in the lower pane) displays the tab properties page of the selected task in the list.

The tab properties page (as shown in) displayed in the lower pane of the scheduler Management Unit is read-only. To edit the attributes associated with a task, right-click the task name in the upper pane and click Properties ". (You can also double-click the task name in the upper pane .) Either way, a dialog box containing readable/writable attributes is opened in a separate window.

In addition to the "History" tab, the tab properties page in the lower pane only displays the content in the "Create task" dialog box in read-only mode (the "Create task" dialog box is a tool used to create a new task ). This dialog box will be discussed in detail in the subsequent sections of this column. On the history tab, you can learn exactly how a task runs, whether it runs, and when it runs. Displays the history Tab Of The automaticbackup task.

On the history tab, you can check whether a scheduled task runs as scheduled.

If you click the history tab, the relevant sections of the Event Viewer snap-in are embedded to list all recent events related to the selected task. If you run evntvwr. MSC, browse applications and services logs \ Microsoft \ Windows \ taskschedational \ operational in the console tree, and then filter the generated event logs to list events related to the selected task, the operation above will also see the same list.

  • To run the Event Viewer snap-in (eventvwr. MSC), click Start and type event viewer in the search box.
    Under "program", double-click "Event Viewer ". If the system prompts you to enter the administrator password or confirm the password, enter the password or confirm the password.

Obviously, to view this information, it is much faster in the task scheduler console than in the Event Viewer console. If the task is not triggered as scheduled or fails to run as scheduled, you can double-click the corresponding event entry to read the details provided by the event log.

Create a task

You can create a task on your computer or on any other computer that you can access. If you want to manage remote computers, but you have not connected to the remote computer, select the project ("task scheduler (local)") at the top of the console tree )"). Then, in the actions pane (or from the actions menu), click Connect to another computer ".
To start creating a new task, click the folder in the console tree to save the task. To create a new folder, right-click the parent folder of the new folder in the console tree, and click "create folder ". Enter a name for the new folder and click OK ".

You can use the create basic task wizard in the scheduled tasks management unit or fill in the Create task dialog box to create a new task. In the "operations" pane or "operations" menu, click "create basic task" to start the Wizard. It is suitable for creating time-triggered tasks involving a single operation.
It is also suitable for creating tasks that run when a user logs on or Windows starts. To learn more about the complex task definition process, complete the "Create task" dialog box. Click (in the console tree) to display the folder of the created task, and then (in the actions pane or from the actions menu) Click Create task ".
The General Tab Of the Create task dialog box is displayed.

On the General tab, the task name must be entered. Other options are optional. The task is created by you (cannot be changed) and runs in your own security context unless you have other settings. If you want a task to run in the security context of another user or group, click "change user or group" and select the required option.

On the General tab, type a name for the new task and specify the user's security context in which the task will run

The most likely situation for you to change the security context is that you want to set the task to run on another computer. If the program you want to run can interact with another user, you should run the program in the security context of another user. If you run a program in your own security context, the task will not run interactively (that is, the user will not see the task ).

Regardless of the user's security context in which the task is to run, you can choose to run the task regardless of whether the user is logged on or not. If you select "run regardless of whether the user logs on or not", you will be prompted to enter the user's password after the task is created. If the password does not exist, you can select "do not store the password ".
As shown in the text next to the check box, the task only has access to local computer resources.

Set a task trigger

A task can be triggered in the following ways:

  • Plan Creation

  • Logon

  • Start

  • Idle

  • When an event occurs

  • When creating/modifying a task

  • When you connect to a user session

  • Disconnection from user sessions

  • Workstation lock timing

  • When the workstation is unlocked

You can create zero, one, or more triggers for a task. If no task trigger is set, you can run the task as needed (unless you clear the "allow on-demand running of tasks" check box in the "Settings" tab of the "Create task" dialog box ).
For example, you can test a new task before placing it into a schedule. If multiple triggers are set, the task is run as long as one trigger is triggered.

To set a trigger, click the "Trigger" tab in the "Create task" dialog box, and then click "new ". In the create trigger dialog box (SEE), select the expected trigger type from the start task menu.

A task can have zero, one, or more triggers.
-You can use advanced settings to set latency, repetition, and expiration parameters.

Note that the advanced settings options at the bottom of the dialog box (SEE ). These options can be used to create latency, repetition, and expiration parameters (and other settings), which are not easy to find when viewing tasks created by you or other users. These options are not displayed in read-only task attributes. If the "Create task" dialog box opens the readable/writable attribute content, you need to select the trigger (on the "Trigger" tab ), click Edit to view or change these advanced options.

Set task operations

In addition to the task name (specified in the "General" tab of the "Create task" dialog box), the only task parameter to be provided is the operation to be performed by the task. To specify task operations, click the "operations" tab in the "Create task" dialog box, click "new", and then select the required options.

Three types of operations can be specified:

  • Start the program

  • Send email

  • Show email

You can specify one or more operations for each type of operation. If multiple operations are specified, these operations are executed sequentially, and each new operation starts to run after the previous operation is completed.

If you select a "Boot Program" type operation, this program can be any object that Windows can execute-Windows programs, batch programs or scripts, documents or shortcuts associated with the program. You can use the "Browse" button to specify a program without entering a long path. In the "add Parameters" box, you can add parameters for the executable file and specify the start folder for the executable file.
If the program requires higher permissions to run successfully, make sure that "run with the highest permission" is selected in the "General" tab of the "Create task" dialog box ".

If you select the "send email" operation, the "Task Scheduler" requires you to provide the address of the outbound (SMTP) server.

If you select "show email", the displayed dialog box provides fields for you to enter the mail title and body.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.