You can automate any routine task that you perform. To do
this, you can use the Task Scheduler service to schedule the task to run
automatically. Not only can you schedule tasks to run once or
periodically, but you can also schedule them to run when the computer
starts, when you log on, or when a specific event occurs.1. Getting Started with Task SchedulingYou use the Task Scheduler to view and work with scheduled
tasks. To access the Task Scheduler, click Start→Control Panel→System
and Security→Administrative Tools→Schedule Tasks. As Figure 1 shows,
scheduled tasks are stored in the Task Scheduler Library. Task Scheduler
displays tasks created by you or other users when you select the Task
Scheduler Library node in the left pane. Unlike earlier versions of
Windows, Windows 7 makes extensive use of scheduled tasks. In the Task
Scheduler Library, you’ll find system tasks under Microsoft\Windows and Microsoft\Windows Defender. Tasks under
Microsoft\Windows handle many of
the background housekeeping tasks on your computer. Tasks under
Microsoft\Windows Defender are used
to automate malware scans. NOTE To ensure that you don’t accidentally delete or modify system
tasks, most system tasks are locked so that you cannot edit them. Some
system tasks are also hidden. In Task Scheduler, you can view hidden
tasks by selecting Show Hidden Tasks on the View menu. Tasks can have many properties associated with them,
including: Triggers that specify the circumstances under which a task
begins and ends Actions that define the action a task performs when it is
started Conditions that qualify the conditions under which a task is
started or stopped Settings that affect the behavior of the task
Based on these properties, you can use Task Manager to create two
types of tasks: basic tasks and advanced tasks. Basic tasks have only
triggers and actions, and are meant to help you quickly schedule a
common task. Advanced tasks have triggers, actions, conditions, and
settings, and are meant to be used by advanced users or
administrators. 2. Creating Basic TasksYou can create a basic task by completing these
steps: Click Start→Control Panel→System and Security→Administrative
Tools→Schedule Tasks. Click the Action menu and then select Create Basic Task. This
starts the Create Basic Task Wizard. On the Create a Basic Task page, type a name and description
of the task. Click Next. On the Task Trigger page, select a run schedule for the task.
You can schedule tasks to run periodically (daily, weekly, or
monthly), or when a specific event occurs, such as when the computer
starts or when the task’s user logs on. Click Next. The next page
you see depends on when the task is scheduled to run. If you’ve selected a daily running task, the Daily page
appears, as shown in Figure 2. Configure the task
using these fields and then click Next: - Start
Use the Start options to set a start date and
time. - Recur every
Allows you to run the task every day, every other day,
or every nth day, beginning with the
start date you set. For example, if you want the task to run
every other day, you’d set the “Recur every X days” text box
to 2 days.
If you’ve selected a weekly running task, the Weekly page
appears, as shown in Figure 3. Configure the task
using these fields and then click Next: - Start
Use the Start options to set a start date and
time. - Recur every
Allows you to run the task every week, every other week,
or every nth week. - Days of the week
Sets the day(s) of the week when the task runs, such as
on Tuesday or on Tuesday and Friday.
If you’ve selected a monthly running task, the Monthly page
appears, as shown in Figure 4. Configure the
task using these fields and then click Next: - Start
Use the Start options to set a start date and
time. - Months
Use this selection list to choose which months the task
runs. You can select all months or months individually. - Days
Sets the day(s) of the month the task runs. For example,
if you select 2 and 8, the task runs on the second and eighth
days of the month. - On
Sets the task to run on the nth
occurrence of a day in a month, such as the second Monday or
the third Tuesday of every month.
If you’ve selected “One time” for running the task, the “One
time” page is displayed. Use the Start options to set a start date
and time. Click Next. If you’ve selected “When a specific event is logged,” the
“When a specific event is logged” page is displayed. You’ll need to
select the event log to monitor and the specific event source, event
ID, or both. Click Next. If you’ve selected “When the computer starts,” the task will
run when the computer starts. If you’ve selected “When I log on,” the task will run only
when you log on. On the Action page, specify the task to perform. You can start
a program, send an email, or display a message. Click Next. The next
page you see depends on the action you selected. If you’ve selected Start a Program, you’ll see the Start a
Program page, shown in Figure 5. Click Browse to display
the Open dialog box and then select the program or script to run.
You’ll find system utilities, such as Disk Cleanup (cleanmgr.exe), in the %SystemDrive%\Windows\System32 folder.
Click Next. If you’ve selected Send an E-mail, you’ll see the Send an
E-mail page. You can then configure the automated email to send by
completing the From, To, Subject, and Text fields of the email
message. In the “SMTP server” text box, enter the FQDN (Fully
Qualified Domain Name) of the mail server through which you will
send your message. Click Next. If you’ve selected Display a Message, you’ll see the Display a
Message page. You can then configure the message to display on the
desktop when the task is started. Enter the title and text of your
message in the text boxes provided. Click Next. On the Summary page, review the task details and then click
Finish. By default, basic tasks you create run under your account
and will run only when you are logged on.
3. Creating Advanced TasksYou can create an advanced task by completing these
steps: Click Start→Control Panel→System and Security and then click
the Schedule Tasks link under Administrative Tools. Click the Action menu and then select Create Task. This opens
the Create Task dialog box. On the General tab, shown in Figure 6, type a name and
description for the task you are creating. By default, the task runs
only when you are logged on. If you want to run the task regardless
of whether you are logged on, select “Run whether user is logged on
or not.” You can also elect to run with highest privileges and
configure the task for earlier releases of Windows. On the Triggers tab, create and manage triggers using the
options provided. Using triggers, you can schedule tasks to run
periodically (daily, weekly, or monthly), or when a specific event
occurs, such as when the computer starts or when the task’s user
logs on. To create a trigger, click New, use the options provided to
configure the trigger, and then click OK. On the Actions tab, create and manage actions using the
options provided. You can start a program, send an email, or display
a message. To create an action, click New, use the options provided
to configure the action, and then click OK. On the Conditions tab, specify any limiting conditions for
starting or stopping the task. On the Settings tab, choose any additional optional settings
for the task. Click OK to create the task.
4. Managing and Troubleshooting TasksYou can access the current tasks configured on your
computer through the Task Scheduler. You can view and manage scheduled
tasks that you or other people created by completing the following
steps: Click Start→Control Panel→System and Security→Administrative
Tools→Schedule Tasks. In the left pane, select the Task Schedule Library node to
display tasks created by you or other people. Select a task to view its properties using the tabs provided
(see Figure 7). Note the task
status, last runtime, and last run result. If a task has a status of
Queued, it is waiting to run at a scheduled time. If a task has a
status of Ready, it is ready to run on its next runtime. If a task
should be running automatically but has a Last Run Time of Never,
you’ll need to check the task’s properties to determine why it isn’t
running. If the Last Run Result is an error, you’ll need to resolve
the referenced problem so that the task can run
normally. If you want to manage the task, right-click the task and
then: Select Delete to delete the task. Select Disable to disable the task so that it doesn’t
run. Select Properties to edit the task’s properties. Select Run to run the task. Select End to stop a running task.
You can view all running tasks by selecting Display All Running
Tasks on the Action menu. When checking for problems with tasks, keep in
mind that a task that is listed as Running might not in fact be running,
but instead might be a hung process. You can check for hung processes
using Last Run Time, which tells you when the task was started. If a
task has been running for more than 24 hours, there is usually a
problem. To stop the task, right-click it in the Task Scheduler and then
select End. When prompted to confirm, click Yes.
|