Freigeben über


MSFT_WmiRegisterNotificationEvent class

The MSFT_WmiRegisterNotificationEvent abstract troubleshooting class represents the creation of an event sink for notification for an event query.

The following syntax is simplified from Managed Object Format (MOF) code and includes all inherited properties. Properties and methods are in alphabetic order, not MOF order.

Syntax

class MSFT_WmiRegisterNotificationEvent : MSFT_WmiEssEvent
{
  uint8  SECURITY_DESCRIPTOR[];
  uint64 TIME_CREATED;
  string Namespace;
  string Query;
  string QueryLanguage;
};

Members

The MSFT_WmiRegisterNotificationEvent class has these types of members:

Properties

The MSFT_WmiRegisterNotificationEvent class has these properties.

Namespace

Data type: string

Access type: Read-only

Namespace in which the event occurred.

Query

Data type: string

Access type: Read-only

The event query used in the call which created the sink.

QueryLanguage

Data type: string

Access type: Read-only

Query language used in the Query property. Currently only WMI Query Language (WQL) is supported.

Example: "WQL"

SECURITY_DESCRIPTOR

Data type: uint8 array

Access type: Read-only

Descriptor that the event provider uses to determine which users can receive the event. For more information, see WMI Security Constants.

This property is inherited from __Event.

TIME_CREATED

Data type: uint64

Access type: Read-only

Unique value that indicates the time the event is generated. This is a 64-bit value that represents the number of 100-nanosecond intervals after January 1, 1601. The information is in the Coordinated Universal Time (UTC) format.

For more information about using uint64 values in scripts, see Scripting in WMI.

This property is inherited from __Event.

Examples

The following VBScript code example receives notifications when a sink is created by a call to SWbemServices.ExecNotificationQueryAsync and when the sink is canceled. It can also receive notifications from calls in C++ like, IWbemServices::ExecNotificationQueryAsync or IWbemServices::CancelAsyncCall.

strComputer = "." 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 
Set MySink = WScript.CreateObject( _
    "WbemScripting.SWbemSink","SINK_")

objWMIservice.ExecNotificationQueryAsync MySink, "SELECT * FROM MSFT_WmiRegisterNotificationSink WITHIN 10"

objWMIservice.ExecNotificationQueryAsync MySink, "SELECT * FROM MSFT_WmiCancelNotificationSink WITHIN 10"

WScript.Echo "Waiting for events..."

While (True)
    Wscript.Sleep(1000)
Wend

Sub SINK_OnObjectReady(objObject, objAsyncContext)
    WScript.Echo "Event has occurred: Event class is " & objObject.Path_.Class & VBNewLine & objObject.Query
 
End Sub

Sub SINK_OnCompleted(objObject, objAsyncContext)
    WScript.Echo "Event call complete."
End Sub

Requirements

Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Namespace
Root\CIMV2
MOF
System.mof
DLL
WmiPrvSD.dll

See also

MSFT_WmiEssEvent

WMI Service Event Troubleshooting Classes

WMI Troubleshooting

WMI Troubleshooting

Monitoring Events