Purpose:Query the Windows Management Interface

 

Format:WMIQUERY [ /A /B /C /H /L /Q /USER=username /PASSWORD=password] namespace "query string" [index]

 

namespaceThe namespace to query        
"query string"WQL query string
indexClass instance

 

/A(ll instances)/L (no blank lines)                
/B(lank)/PASSWORD
/C(lasses)/Q(uiet)
/H(eader)/USER

 

Usage:

 

You can use a single period . for namespace to default to root\cimv2.

 

WMIQUERY also supports remote queries. The namespace argument for remote servers will look like "\\remote-server\root\cimv2" (substitute your server name for "remote-server").

 

For more details on what is available, see the Microsoft WMI and WQL documentation:

 

WMI Reference - Win32 apps | Microsoft Docs

 

Examples:

 

To query the name property from the Win32_Processor class:

 

wmiquery root\cimv2 "SELECT name FROM Win32_Processor"

 

To query available classes:

 

wmiquery /A root "select name from __namespace"

 

Options:

 

/A Display all class instances starting at "index".

 

/BSeparate class instances with a blank line.

 

/CDisplay all the matching class names for the specified namespace. "query string" is the filter to apply to the returned values; it can contain wildcards. For example:

 

wmiquery /c . "win32_q*"

 

/HDisplay a header for class instances.

 

/LDon't separate records with a CR/LF. (This is probably only useful when you are querying single-line records.)

 

/PASSWORD=passwordThe password to use for remote queries.

 

/QDon't display the property name when displaying properties.

 

/USER=nameThe user name to use for remote queries.