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 | ||
| Bluetooth | root/CIMV2 | Win32_PnPEntity | PNPClass='Bluetooth' |
|
| CPU | root/CIMV2 | Win32_Processor | ||
| Floppy Disk | root/CIMV2 | Win32_LogicalDisk | MediaType IS NOT NULL AND MediaType != 0 AND MediaType != 11 AND MediaType != 12 |
MediaType can also be used to get an indication of the floppy drive's capacity, but it may be unreliable if no disk is loaded |
| 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 | |||
| 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, type and manufacturer (may list disconnected monitors) | |
MonitorType='Default Monitor' AND MonitorManufacturer IS NULL |
Currently connected monitors only | |||
| root/WMI | WmiMonitorID | Instances of these classes can be linked by their shared InstanceName property |
Manufacturer, serial number (currently connected monitors only) | |
| WmiMonitorBasicDisplayParams | Physical screen size, analog/digital video input (currently connected monitors only) | |||
| Mouse | root/CIMV2 | Win32_PointingDevice | Mouse type, buttons, connector | |
| root/WMI | MSMouse_PortInformation | Buttons, connector | ||
| Network Adapter | root/CIMV2 | Win32_NetworkAdapter | MACAddress IS NOT NULL | Windows XP |
| PhysicalAdapter=TRUE | Windows 7..11 | |||
| root/WMI | MSNdis_LinkSpeed | Speed | ||
| MSNdis_PhysicalMediumType | Physical medium (wired, wifi, etc.) | |||
| root/StandardCimv2 | MSFT_NetAdapter | Windows 8..11, lists physical adapters only, more details | ||
| 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 | NOT PrintProcessor='winprint' | Physical printers | |
| MSFT_3DPrinter | 3D-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: 2024-03-11; loaded in 0.0085 seconds