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
  1. From the drop-down list box, choose Filters.
  2. Click the class you want to create an instance, and click the New Instance button.

    —or—

  3. 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.

  1. In the Edit new instance properties dialog box, type the following:
    1. In the Name field, type a name for the filter.
    2. In the Query field, type a WQL SELECT statement that specifies the event criteria.
    3. In the Query Language field, type WQL.
  2. 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.

  1. From the drop-down list box, choose Filters.
  2. Click the __EventFilter class, and click the New Instance button.

    —or—

  3. Right-click on the __EventFilter class, and choose New Instance from the pop-up menu. The Edit new instance properties dialog box appears.

  1. In the Edit new instance properties dialog box, type the following:
    1. In the Name field, type ServiceStoppedEvent.
    2. 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"
      
    3. In the Query Language field, type WQL.
  2. 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.

  1. From the drop-down list box, choose Filters.
  2. Click the __EventFilter class, and click the New Instance button.

    —or—

  3. Right-click on the __EventFilter class, and choose New Instance from the pop-up menu. The Edit new instance properties dialog box appears.

  1. In the Edit new instance properties dialog box, type the following:
    1. In the Name field, type IntervalTimerFilter.
    2. In the Query field, type the following WQL SELECT statement to specify the event criteria:
      select * from __TimerEvent
      
    3. In the Query Language field, type WQL.
  2. 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.

  1. From the drop-down list box, choose Filters.
  2. Click the __EventFilter class, and click the New Instance button.

    —or—

  3. Right-click on the __EventFilter class, and choose New Instance from the pop-up menu. The Edit new instance properties dialog box appears.

  1. In the Edit new instance properties dialog box, type the following:
    1. In the Name field, type AbsTimerFilter.
    2. In the Query field, type the following WQL SELECT statement to specify the event criteria:
      select * from __TimerEvent where TimerId="AbsTimer"
      
    3. In the Query Language field, type WQL.
  2. 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