In last week's edition of the Windows Vista Report, "Take Advantage of Vista's Event Viewer and Task Scheduler Integration," I showed you how to take advantage of the new integration between Scheduler and Event Viewer that allows you to 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.
When you attach a task to an event in Event Viewer, the operation launches the Create Basic Task wizard, which is pretty much the same wizard that Task Scheduler provides except that it is specifically targeted on events in Event Viewer. In most cases, the Create Basic Task wizard is all you'll ever need to keep tabs on events.
However, if you feel that you need to be able to create a more feature-rich event trigger, then you'll want to work right from within Task Scheduler itself and take advantage of the new custom event trigger settings. That's right; the integration between Event Viewer and Task Scheduler goes both ways in Windows Vista.
In this edition of the Windows Vista Report, I'll show you how to create custom event trigger in Task Scheduler.
This blog post is also available in the PDF format in a TechRepublic download.
Getting startedTo begin, right-click on the Computer icon and select the Manage command. When the Computer Management window appears, locate and open the Task Scheduler branch in the Console Tree. Then, in the Actions pane, locate the Create Task action, as shown in Figure A, and click it.
Locate and click the Create Task action in the Actions pane.When you see the Create Task window, shown in Figure B, you'll see that rather than using a wizard interface, the Create Task action uses a tabbed interface that will provide you with more advanced options for creating a customized task. (Keep in mind that there are more options and settings in this tabbed interface than I will describe here.)
The Create Task action uses a tabbed interface to provide you with a host of advanced options for creating a customized task.
As you can see, in addition to specifying a name and description, the General tab allows you to configure a set of task Security Options. By default, a scheduled task runs only when the user who scheduled the task is logged on to the computer. However, if you want the task to be triggered by an event that may occur even when you're not logged on, such as in the evening when you've logged off the computer for the day, you can select the Run Whether User Is Logged On Or Not option. You'll be prompted to supply your username and password when saving the task. If you select the Do Not Store Password check box, Task Scheduler keeps your username and password only until needed and then discards them.
TriggersWhen you select the Triggers tab, you will then click the New button to create the actual trigger for this task. When the New Trigger dialog box appears, you'll select On An Event from the Begin The Task drop-down menu. The options in the New Trigger dialog box will change to provide a set of options appropriate for an event trigger, as shown in Figure C.
You'll need to select the On An Event option from the Begin The Task drop-down menu to display a set of options appropriate for an event trigger.As you can see, the Settings panel contains two options titled Basic and Custom, and they control the level of detail displayed in the adjacent panel. The Basic setting provides you with the option of choosing a Log, Source, and Event ID, just like in the Create Basic Task Wizard. However, if you select the Custom option button, the panel will just display a button titled New Event Filter, as shown in Figure D.
When you select the Custom option button, the panel will just display a button titled New Event Filter.When you click the New Event Filter button, you'll see the New Event Filter dialog box, shown in Figure E. As you can imagine, the majority of the features in the New Event Filter dialog box are designed to allow you to create a custom view in the Event Log, just like the Filters feature in the previous version of the Event Viewer. However, you can harness several of these features to allow you to create a custom event trigger.
For instance, you can create an event trigger that monitors multiple event logs, multiple event sources, multiple event levels, or multiple event IDs, and then fires off the task when the specific combination that you specify occurs.
You can use many of the settings in the New Event Filter dialog box to configure a custom event trigger.Using the Event Level check boxes, you can specify what event levels you want to include. You can then select the By Log option and then use the Event Logs drop-down menu to select the check boxes next to the event logs you want to monitor, as shown in Figure F.
Likewise, you can select the By Source option and then use the Event Sources drop-down menu to select the check boxes next to the event logs you want to monitor. In Event IDs text box, you can type a specific event ID, multiple event IDs separated by commas, or even a range of IDs separated by a hyphen.
You can specify multiple event logs to monitor.
When you click OK, you'll return to the New Trigger dialog box and can select any of the Advanced Settings, which provide you with a host of settings that you can use to specify how and when the task is to run.
ActionsWhen you click OK, you'll return to the Create Task window and can select the Actions tab. Just like in the Basic Task Wizard, you can start a program, send an e-mail, or display a message. However, with the custom event trigger, you can specify multiple actions to take place when the event trigger occurs. As you can see in Figure G, my example task will both display a message box and send an e-mail message when the event trigger occurs.
You can specify multiple actions to take place when an event occurs.
Completing the event trigger
The options on the Conditions tab allow you to specify when the task is to run, and the options on the Settings tab allow you to specify how a task is run, stopped, or deleted. However, for an event trigger, chances are that you won't need to alter the default settings. As such, you can complete the custom event trigger configuration operation by clicking OK.
What's your take?
What's your take on the Event Viewer and Task Scheduler integration feature? Are you likely to take advantage of this new feature? Please drop by the Discussion Area and let us hear from you.
Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.