Working with the Windows Server 2008 Task Scheduler (Part 2)

by [Published on 20 Jan. 2009 / Last Updated on 20 Jan. 2009]

Creating tasks and seeing which tasks are scheduled to run on your system.

If you missed the first part of this article series please read Working with the Windows Server 2008 Task Scheduler (Part 1).

Introduction

In the first part of this article series, I showed you some of the various features of the Windows Server 2008 Task Scheduler. In this article, I want to conclude the series by showing you how to create a task, and by showing you some of the tasks that are set up by default.

Creating a Task

It is fairly simple to create a task in the Windows Server 2008 Task Scheduler. Begin the process by clicking on the Create Basic Task link found in the Actions pane of the Task Scheduler console. When you do, Windows will launch the Create Basic Task Wizard. The wizard's welcome screen requires you to enter a name for the task that you are creating. You also have the option of entering a description, but you do not have to. Even so, I tend to think that it is probably a good idea to enter a description of the task, its purpose, and what triggers the task. The reason why I say this is because eventually you may end up with several different tasks that you have created, and it may be difficult to remember the specifics of what exactly each one does. If you take a little bit of time now to create a thorough description of the task, it may save you from having to try to decipher the task's purpose later on.

Once you have entered a name and description for the task that you are creating, click Next and you will be taken to the wizard’s Task Trigger screen. The screen allows you to decide what events must occur in order to trigger the task. Most of the options on the screen are schedule related. For example, you can schedule the task to run daily, weekly, monthly, or at a predetermined time. Of course you do not have to run a task on a schedule. You also have the option of triggering the task to run when the computer boots up, when someone logs in, or when a specific event is written to the Windows event logs. You can see what the Triggers screen looks like in Figure A.


Figure A: You must tell the Task Scheduler when to start the task.

When you click Next, you may see a screen asking for additional information depending on which option you have chosen to use as the task trigger. For example, if you are scheduling the task to run at a specific time or on a specific date, then the next screen that you will see asks you to specify the date and time when the task should run. If your triggering the task to run in response to an event that is written to the Windows event logs, then the next screen that you will encounter prompts you to choose the event log that you want to monitor, the source of the event, and the event code to look for, as shown in Figure B.


Figure B: You may see a screen asking you to supply additional information, depending on the option that you have previously chosen

Once you have supplied any required information, click Next, and you will see the Action screen, shown in Figure C. As you can see in the figure, you are given a choice of either; starting a program, sending an E-mail message, or displaying a network message in response to an event trigger.


Figure C: You are given a choice of either starting a program, sending an E-mail message, or displaying a network message in response to an event trigger

When you click Next, you will see a screen prompting you to enter additional information. Once again though, the information that is required is going to vary depending on the type of action that you have chosen to perform. For example, if you have chosen to launch a program, then you will be prompted to enter the program’s name, and optional arguments that you want to specify, and the startup directory. On the other hand, if you choose to send an E-mail message then you must provide an E-mail address, a subject line, the message’s text, and the name of the SMTP server that will be used to transmit the message. Incidentally, you also have the option of including a message attachment.

Click Next, and you will see a screen displaying a summary of the task that you have created. One thing that I really like about this screen is that it contains a check box that you can select if you want Windows to open the task’s properties sheet when you are done. As I explained in the first part of this article series, the task’s properties sheet allows you to access the more advanced settings for the task. Even if you aren’t planning on adjusting any of the task’s advanced settings, I recommend going ahead and opening the task’s properties sheet and checking out the General tab. The General tab contains some options that control whether or not the user has to be logged on in order for the task to run, and whether or not the task needs to run with the highest privileges. By default, Windows Server 2008 does require a user to be logged on in order for a task to run. Obviously, this isn’t usually practical for server related tasks, so you may want to make the change.

Which Tasks Are Active?

The last thing that I want to show you is how you can figure out which tasks are configured to run on your system. You can see all of the tasks that you have created by selecting the console’s Task Scheduler Library container. As you can see in Figure D, selecting this container causes Windows to display all of the scheduled tasks, as well as the properties sheet for the selected task.


Figure D: You can see your scheduled tasks by selecting the Task Scheduler Library container

System Maintenance Tasks

If you look at the figure above, you will notice that there are a lot of sub containers beneath the Task Scheduler Library container. These sub containers are related to various system maintenance tasks that Microsoft has designed Windows to perform automatically. For example, if you look at Figure E, you can see that Windows is configured to defragment the hard drive at 1:00 AM on every Wednesday. Of course this is just one of the built in tasks. If you look at the various sub containers, you can see that there are quite a few built in tasks related to various aspects of the Windows operating system. The built in tasks are important for keeping Windows running smoothly, so I recommend leaving these tasks alone.


Figure E: Microsoft has created a number of built in tasks that are designed to keep the system running in an optimal manner

Conclusion

In this article series, I have talked about the Windows task scheduler, and how different the new interface is from what was previously available in other versions of Windows. I then went on to show you how to schedule tasks and how to see which tasks were currently scheduled to run.

If you missed the first part of this article series please read Working with the Windows Server 2008 Task Scheduler (Part 1).

Featured Links