Take advantage of Vista's Event Viewer and Task Scheduler integration

In this edition of the Windows Vista Report, Greg Shultz shows you how to take advantage of the Event Viewer and Task Scheduler integration feature.

The EventTriggers command in Microsoft Windows XP would allow you to configure your system to provide notifications when certain events were recorded in one of the operating system's log files. While this was an extremely handy command to have in your troubleshooting arsenal, the fact that it was a command-line tool that had to be configured with a bewildering number of special parameters made using it a bit daunting. However, if you were able to master and use the EventTriggers command in Windows XP, chances are that you really appreciated the convenience it provided.

If you have moved to Windows Vista, you may have shelled out to a command prompt and attempted to run the EventTriggers command. If you have, you have undoubtedly discovered that the EventTriggers command is not included with Vista.

The reason that Microsoft removed the EventTriggers command from Vista is because they have replaced it with a totally new mechanism that integrates Task Scheduler with Event Viewer such that you can now attach a task directly to the event and then configure the task to perform any one of several operations whenever the event occurs and is logged in Event Viewer.

In this edition of the Windows Vista Report, I'll show you how to take advantage of this new Event Viewer and Task Scheduler integration feature.

This blog post is also available in PDF format in a TechRepublic download.

Getting started

To begin, right-click on the Computer icon and select the Manage command. When the Computer Management window appears, locate and open the Event Viewer branch in the Console Tree. Then, open the log that contains the event that you want to keep tabs on. Once you locate the event, simply right-click on it and select the Attach Task To This Event command, as shown in Figure A.

Figure A

When you right-click on any event, you'll see that the context menu allows you to associate the event with a task.
You'll then see the Create Basic Task wizard, shown in Figure B. As you can see, this is pretty much the same wizard that Task Scheduler provides except that it is specifically targeted on events in Event Viewer. At this point, you can provide a name for the task as well as a detailed description.

Figure B

A version of Task Scheduler's Create a Basic Task wizard appears that is targeted on the event you selected.
When you click Next, you'll see the When a Specific Event Is Logged screen, shown in Figure C. Since the task is already targeted on the event that you selected, there are no settings that you can configure on this page, simply click the Next button.

Figure C

The settings on this part of the wizard are preconfigured.
You'll now see the Action screen, shown in Figure D, and can choose from one of the three actions displayed. As you can see, you can Start a Program, Send an E-mail, or Display a Message.

Figure D

There are three actions that you can associate with the event in question.

Start a program

If you select the Start a Program option and then click Next, you'll see the Start a Program screen, shown in Figure E. You can click the Browse button and then locate and select any executable file, a batch file, or a script. If you're running a command-line tool, you can specify any parameters in the Add Arguments text box. You can even specify the directory in which you want the program to launch in the Start In text box.

Figure E

You can have the task run any executable file, batch file, or even a script.
When you click Next, you'll see the Summary screen, shown in Figure F, which lists all the details about the task that you just created. If you want to see the Properties dialog box for the task, be sure to select the check box.

Figure F

The Summary screen allows you to double-check your settings before you commit.
When you click Finish, you'll see an informational message box like the one shown in Figure G. As you can see, this message tells you that the Event Task that you just created is stored in Task Scheduler and that if you want to alter the task, you can do so from within Task Scheduler. How's that for integration?

Figure G

The Event Task is stored and can be altered in Task Scheduler.

Send an e-mail

Now, if you select the Send an E-mail option and then click Next, you'll see the Send an E-mail screen, shown in Figure H. As you can see, everything that you would need to compose a message in an e-mail is just where you would expect. You can even add an attachment if you want!

Figure H

Everything that you would expect in an e-mail client's compose a message window is available here.

At the very bottom you can specify the name of the SMTP server to use to send the e-mail.

Display a message

If you select the Display a Message option and then click Next, you'll see the Display a Message screen, shown in Figure I. As you can imagine, this feature allows you to essentially create your own warning dialog box. You simply give it a title and as detailed a message as you want.

Figure I

You can now give those silent and often deadly events a real voice with a custom message box.

If you've ever looked through the Event Viewer logs and discovered a dangerous event occurring at regular intervals that you'd never know about unless you looked in Event Viewer, then you will immediately recognize the benefit of the Display a Message option. Now, you can give those silent and often "deadly over time if left unattended" events a real voice.

What's your take?

What's your take on the Event Viewer and Task Scheduler integration feature? Did you use the old EventTriggers command in Windows XP? Are you likely to take advantage of this new feature? Please drop by the Discussion Area and let us hear from you.