The WMI Query Language
WMI Query Language, or WQL, is used to query WMI in a similar style to SQL.
WQL implements a subset of Structured Query Language (SQL). The keywords are traditionally written in uppercase; however, WQL is not case-sensitive.
Both the CIM and the older WMI cmdlets support the Filter
and Query
parameters, which accept WQL queries.
Understanding SELECT, WHERE, and FROM
The SELECT
, WHERE
, and FROM
keywords are used with the Query
parameter.
The generalized syntax for the Query
parameter is as follows:
SELECT <Properties> FROM <WMI Class>
SELECT <Properties> FROM <WMI Class> WHERE <Condition>
You can use the wildcard *
to request all available properties or a list of known properties:
Get-CimInstance -Query "SELECT * FROM Win32_Process"
Get-CimInstance -Query "SELECT ProcessID, CommandLine FROM Win32_Process"
The WHERE
keyword is used to filter results returned by SELECT
;...