Creating an Event Filter Instance
[This is preliminary documentation and subject to change.]
Event filters define criteria for receiving event notifications.
You create event filters as instances of a given class. This version of WBEM contains the predefined __EventFilter system class.
The first procedure describes how to create an event consumer instance. The other procedures are examples intended to work along with the example consumers and timers.
To create an event filter instance
-
From the drop-down list box, choose Filters.
-
Click the class you want to create an instance, and click the New Instance button.
—or—
-
Right-click on the class you want to create an instance, and choose New Instance from the pop-up menu. The Edit new instance properties dialog box appears.
-
In the Edit new instance properties dialog box, type the following:
-
In the Name field, type a name for the filter.
-
In the Query field, type a WQL SELECT statement that specifies the event criteria.
-
In the Query Language field, type WQL.
-
Click OK to create the instance.
To create the ServiceStoppedEvent filter
This example defines a filter that works with the ServiceStopped consumer to display an event notification in the Event Viewer when a system service is stopped.
-
From the drop-down list box, choose Filters.
-
Click the __EventFilter class, and click the New Instance button.
—or—
-
Right-click on the __EventFilter class, and choose New Instance from the pop-up menu. The Edit new instance properties dialog box appears.
-
In the Edit new instance properties dialog box, type the following:
-
In the Name field, type ServiceStoppedEvent.
-
In the Query field, type the following WQL SELECT statement to specify the event criteria:
select * from __InstanceModificationEvent within 5 where TargetInstance isa "Win32_Service" and TargetInstance.State="Stopped"
-
In the Query Language field, type WQL.
-
Click OK to create the instance.
To create IntervalTimerFilter
This example defines a filter that works with the TimerEvent consumer and IntervalTimer to display an event notification in the Event Viewer every 5 seconds.
-
From the drop-down list box, choose Filters.
-
Click the __EventFilter class, and click the New Instance button.
—or—
-
Right-click on the __EventFilter class, and choose New Instance from the pop-up menu. The Edit new instance properties dialog box appears.
-
In the Edit new instance properties dialog box, type the following:
-
In the Name field, type IntervalTimerFilter.
-
In the Query field, type the following WQL SELECT statement to specify the event criteria:
select * from __TimerEvent
-
In the Query Language field, type WQL.
-
Click OK to create the instance.
To create the AbsTimerFilter
This example defines a filter that works with the TimerEvent consumer and AbsTimer to display an event notification in the Event Viewer at a specified date and time.
-
From the drop-down list box, choose Filters.
-
Click the __EventFilter class, and click the New Instance button.
—or—
-
Right-click on the __EventFilter class, and choose New Instance from the pop-up menu. The Edit new instance properties dialog box appears.
-
In the Edit new instance properties dialog box, type the following:
-
In the Name field, type AbsTimerFilter.
-
In the Query field, type the following WQL SELECT statement to specify the event criteria:
select * from __TimerEvent where TimerId="AbsTimer"
-
In the Query Language field, type WQL.
-
Click OK to create the instance.
Viewing Class Properties
Creating an Event Consumer Instance
Creating an Event Timer Instance
Registering a Consumer for an Event
See Also
__EventFilter
Creating an Event Filter
Event Queries
WBEM Query Language