使用VBScript,如何列出代表事件的所有WMI类?
提前致谢。
答案 0 :(得分:3)
您可以将WMI schema query用于从__EVENT继承的类。一个例子是:
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