请查阅MSDN中关于WMI Scripting Primer的部分,极其有用的。或者搜索:winmgmts
例子:
strComputer = "."
strNamespace = "\root\cimv2"
strClass = "Win32_Service"
Set objSWbemServices = GetObject("winmgmts:\\" & strComputer & strNamespace)
Set colSWbemObjectSet = objSWbemServices.ExecQuery("SELECT * FROM " & strClass)
For Each objSWbemObject In colSWbemObjectSet
WScript.Echo "Display Name: " & objSWbemObject.DisplayName
WScript.Echo "State: " & objSWbemObject.State
WScript.Echo "Start Mode: " & objSWbemObject.StartMode
Next
Visual Basic and VBScript support the following syntax:
Set objinst = GetObject("WinMgmts:Win32_LogicalDisk")
Windows Script Host (WSH) also supports:
<OBJECT id="myLocator" progid="WbemScripting.SWbemLocator"></OBJECT>