Using VBScript, how can I list all WMI classes that represent events?
Thanks in advance.
Using VBScript, how can I list all WMI classes that represent events?
Thanks in advance.
You can use WMI schema query for classes that inherit from __EVENT. An example would be:
Function GetWmiEventClasses(computerName)
Dim wmiRoot
Dim eventClasses
Set wmiRoot = GetObject("winmgmts:\\" & computerName & "\root\cimv2")
Set eventClasses = wmiRoot.ExecQuery("select * from meta_class where __this isa '__event'")
Set GetWmiEventClasses = eventClasses
End Function
USAGE:
Set eventClasses = GetWmiEventClasses("." )
If Not eventClasses Is Nothing Then
Dim eventClass
For Each eventClass In eventClasses
WScript.Echo eventClass.Path_.Class
Next
End If