Question

I need to write a WMI query where I need to check that some value is equal to one of the values in the list, but I didn't find that WQL supports IN operator like SQL.

For example:

SELECT * FROM Device WHERE __CLASS IN ("Device1", "Device20").

What are the ways how to write this query?

Thanks.

Was it helpful?

Solution

The WMI uses the WQL language which is only a subset of the SQL language, and doesn't include the IN operator.

So you can rewrote tor sentence using the OR operator , like so

SELECT * FROM Win32_LogicalDisk  Where (DriveType=3) or (DriveType=5)

or using the your WQL sentence.

SELECT * FROM Device WHERE (__CLASS="Device1") OR (__CLASS="Device20")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top