Rob van der Woude's Scripting Pages

WMI Queries for Hardware

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


Powered by GeSHi
Note: Win32_VideoController's UInt32 property AdapterRAM cannot return values exceeding 4GB.
Use the following code, based on PowerShell code by "farag" at, to read the correct value from the registry (assuming a single video card):


  2. SET RegKey=HKLM\SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\0000
  3. FOR /F "tokens=3" %%A IN ('REG Query %RegKey% /V HardwareInformation.qwMemorySize') DO (
  4. 	SET VidMem=%%A
  5. 	REM Remove last 5 hex digits to integer divide by 1 MB
  6. 	SET /A VidMem = !VidMem:~0,-5!
  7. 	REM Result will now most likely be in Int32 range and can be divided by 1024
  8. 	SET /A VidMem /= 1024
  9. 	ECHO Video memory: !VidMem! GB
  10. )



  1. $regKey = 'HKLM:\SYSTEM\ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\0000'
  2. $vidMem = ( Get-ItemProperty -Path $regKey ).'HardwareInformation.qwMemorySize'
  3. Write-Host ( "Video memory: {0} GB" -f ( $vidMem / 1GB ) )



  1. Const HKEY_LOCAL_MACHINE = &H80000002
  2. strRegKey = "SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\0000"
  3. Set objReg = GetObject( "winmgmts:{impersonationLevel=impersonate}!//./root/default:StdRegProv" )
  4. objReg.GetQWordValue HKEY_LOCAL_MACHINE, strRegKey, "HardwareInformation.qwMemorySize", lngVidMem
  5. Set objReg = Nothing
  6. WScript.Echo "Video memory: " & Round( lngVidMem / ( 1024 * 1024 * 1024 ) ) & " GB"




Using These WMI Queries

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



More to Explore

page last modified: 2024-03-11; loaded in 0.0495 seconds