Creating a WMI filter covering two classes

I'm trying to create a WMI filter to select all workstations and RDS servers

I currently am using

SELECT * FROM Win32_OperatingSystem WHERE (ProductType = "1") OR (CSName = "288-RDS01") OR (CSName = "288-RDS02")

But if the RDS server names change this will not work.

Ideally I would like to run something closer to

SELECT * FROM Win32_OperatingSystem WHERE (ProductType = "1"); SELECT * FROM Win32_ServerFeature WHERE ID = 18

From my research it seems like if I have 2 queries applied to the filter, both would have to return true for the filter to return true.

Is this possible or is the first query the best I am going to get?

I ended up going with

SELECT * FROM Win32_OperatingSystem WHERE (ProductType = "1") OR (CSName LIKE "288-RDS%")

But if anyone has improvements or another way of doing it I would like to know.


Solution 1:

Seems like you have a naming convention, so maybe you can do something like this: SELECT * FROM Win32_ComputerSystem WHERE (Name LIKE '%-RDS%') OR (Name LIKE '%whatever%')