The following table lists a collection of WMI classes and queries that can be useful for hardware inventories.
Hardware Type | WMI | Remarks | ||
---|---|---|---|---|
Namespace | Class | Filter | ||
BIOS | root/CIMV2 | Win32_BIOS | ||
CPU | root/CIMV2 | Win32_Processor | ||
Harddisk | root/CIMV2 | Win32_DiskDrive | Physical disks | |
Win32_DiskDriveToDiskPartition | Partitions on disks | |||
Win32_DiskPartition | Partitions | |||
Win32_LogicalDisk | Volumes | |||
Win32_LogicalDiskToPartition | Volumes in partitions | |||
root/Microsoft/Windows/Storage | MSFT_PhysicalDisk | Physical disks; more reliable than root/CIMV2 's Win32_DiskDrive |
||
MSFT_Volume | Volumes | |||
Harddisk Controller | root/CIMV2 | Win32_IDEController | IDE & SATA | |
Win32_SCSIController | SCSI & SATA | |||
Floppy Disk | root/CIMV2 | Win32_LogicalDisk | MediaType IS NOT NULL AND MediaType != 0 AND MediaType != 11 AND MediaType != 12 |
MediaType can also used to get an indication of the floppy drive's capacity, but it may be unreliable if no disk is loaded |
Keyboard | root/CIMV2 | Win32_Keyboard | Keyboard type, layout, function keys | |
root/WMI | MSKeyboard_PortInformation | Function keys, indicators, connector | ||
Main Board | root/CIMV2 | Win32_BaseBoard | ||
Memory | root/CIMV2 | Win32_PhysicalMemory | Memory hardware | |
Monitor | root/CIMV2 | Win32_DesktopMonitor | Screen resolution (desktop monitor only) | |
root/WMI | WmiMonitorID | Instances of these classes can be linked by their shared InstanceName property |
Manufacturer, serial number | |
WmiMonitorBasicDisplayParams | Physical screen size, video inputs | |||
Mouse | root/WMI | MSMouse_PortInformation | Mouse type, buttons, connector | |
Network Adapter | root/CIMV2 | Win32_NetworkAdapter | MACAddress IS NOT NULL | Windows XP |
PhysicalAdapter=TRUE | Windows 7..11 | |||
root/StandardCimv2 | MSFT_NetAdapter | Windows 8..11, lists physical adapters only | ||
Optical Disk | root/CIMV2 | Win32_CDROMDrive | ||
Parallel Port | root/CIMV2 | Win32_ParallelPort | ||
Printer | root/CIMV2 | Win32_Printer | Network=TRUE | Network printers |
Local=TRUE | Local printers | |||
Local=TRUE AND NOT PrintProcessor='winprint' | Local physical printers | |||
root/StandardCimv2 | MSFT_Printer | PrintProcessor != 'winprint' | Physical printers | |
Serial Port | root/CIMV2 | Win32_SerialPort | ||
Sound | root/CIMV2 | Win32_SoundDevice | NOT Manufacturer='Microsoft' | |
System Slot | root/CIMV2 | Win32_SystemSlot | SlotDesignation LIKE 'PCI%' | PCI* slots |
SlotDesignation LIKE 'AGP%' | AGP slots | |||
USB Port | root/CIMV2 | Win32_USBController | All USB ports | |
Name LIKE '%USB 3%' | USB 3 ports | |||
Video | root/CIMV2 | Win32_VideoController | See note on video memory |
Note: | Win32_VideoController 's UInt32 property AdapterRAM cannot return values exceeding 4GB.Use the following code, based on PowerShell code by "farag" at SuperUser.com, to read the correct value from the registry (assuming a single video card): Batch
PowerShell
VBScript
|
To use these queries in scripts, download and start WMIGen, select the appropriate namespace (root/CIMV2
in most cases), and scroll to the appropriate class, e.g. Win32_Printer
.
Select the scripting language you want to use, e.g. "Batch", and click the "Generate" button to generate the code.
The main line of code of the generated example is:
WMIC.EXE /Node:"%Node%" Path Win32_Printer Get /Format:Value
Add a filter from the table, if required, and limit the output to a single property or selection of properties, instead of all properties:
WMIC.EXE /Node:"%Node%" Path Win32_Printer Where "Local=TRUE AND NOT PrintProcessor='winprint'" Get DriverName /Format:Value
Save the modified script, run it, and you will get a list of locally installed physical printers:
DriverName=Canon iP4700 series DriverName=HP LaserJet P2050 Series PCL6
page last modified: 2022-04-18