- The great thing about WMI is that it provides metadata about itself. Maclin provides this example of WSH VBScript code to recursively enumerate namespaces: The namespaces are:
root/SECURITY root/SecurityCenter root/WMI root/WMI/ms_409 root/CIMV2 root/CIMV2/ms_409 root/CIMV2/Applications root/CIMV2/Applications/MicrosoftACT root/CIMV2/Applications/MicrosoftIE root/Microsoft root/Microsoft/HomeNet root/DEFAULT root/DEFAULT/ms_409 root/directory root/directory/LDAP root/directory/LDAP/ms_409 root/subscription root/subscription/ms_409 root/MSAPPS11
Example:
wbemdump /Q root\cimv2 WQL "select Manufacturer from Win32_SystemEnclosure
This returns a number (such as "6").
Some applications provide an English translation, such as a datamap.ini that contains:
[INV_List_ChassisTypes] 0 = Unknown 1 = Other 2 = Unknown 3 = Desktop 4 = Low Profile Desktop 5 = Pizza Box 6 = Mini Tower 7 = Tower 8 = Portable etc. 9 = Laptop 10 = Notebook 11 = Hand Held 12 = Docking Station 13 = All in One 14 = Sub Notebook 15 = Space-Saving 16 = Lunch Box 17 = Main System Chassis 18 = Expansion Chassis 19 = SubChassis 20 = Bus Expansion Chassis 21 = Peripheral Chassis 22 = Storage Chassis 23 = Rack Mount Chassis 24 = Sealed-Case PC
Every WMI class has a "Caption" property — a short description of the object-a one-line string.
A WSH query to a remote computer can be defined using the winmgmts: object:
Set objWMIService = GetObject("winmgmts://Computer_B\root\cimv2)
The .NET sample application "Processes and Services Explorer" PsView.exe is installed by running the .NET nmake (from the VS.NET Bin folder) while in Program Files\Microsoft Visual Studio .NET 2003 folderSDK\v1.1\Samples\Technologies\Interop\Applications\WMI
The installation depends on the WBEMSCRIPTING.dll which is also used by HealthMonitor, a free Windows Service app developed Vitorio Parvesi with VB.NET and WMI to check Windows system status (event viewer, disk free space, services status, performance, etc....)
The C# source for the program is in subfolder Form