Useful WMI namespaces and classes

Posted: (EET/GMT+2)

 

If you are working with WMI scripts or WMIC, a few namespaces and classes are especially useful for retrieving system and network information.

Most common management data is available under the default namespace:

root\cimv2

This namespace contains classes for operating system, hardware, services, processes, and networking.

Some commonly used WMI classes include:

Win32_OperatingSystem
Win32_Process
Win32_Service
Win32_LogicalDisk
Win32_NetworkAdapterConfiguration
Win32_ComputerSystem

You can query them using WMIC:

wmic os get Caption,Version
wmic process list brief
wmic logicaldisk get DeviceID,FreeSpace

WMI queries use a SQL-like syntax (the WQL language). For example:

SELECT *
FROM Win32_Process
WHERE Name = 'notepad.exe'

Network configuration can also be queried:

wmic nicconfig get Description,IPAddress

Other useful namespaces include:

root\default
root\security
root\subscription

Most administration scripts use root\cimv2 for day-to-day management tasks.

Happy hacking!