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.
The WMI reference describes the keywords available: https://learn.microsoft.com/windows/win32/wmisdk/wql-sql-for-wmi.
Certain products like Microsoft System Center Configuration Manager (SCCM) extend WQL. The extended keywords may only be used with WMI classes defined by SCCM: https://learn.microsoft.com/mem/configmgr/develop/core/understand/extended-wmi-query-language.
Both the CIM and the older WMI commands 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 of either Get-CimInstance
or Get-WmiObject
.
The generalized syntax for the Query
parameter is as follows:
SELECT <Properties> FROM <WMI Class>
SELECT <Properties...