Useful Windows WMI Filters for Various Machine Environments (OS) * Updated

Last Updated on

WMI filters are absolutely critical when deploying components in an environment with various Windows Operating Systems, IE servers, clients, architecture and application level.  This is a basic reference that can assist in generating criteria to properly identify a target machine.  Coupled with Group Policy these filters can be a powerful tool to precisely target machines / users / environments etc.

Criteria Key:

Any Windows Client / Desktop OS

1
2
3
4
5
6
7
8
Any Windows Desktop OS – Version 1
SELECT * FROM Win32_OperatingSystem WHERE ProductType = "1"
Any Windows Desktop OS – Version 2 (better FOR Win7 sometimes)
SELECT * FROM Win32_OperatingSystem WHERE (ProductType <> "2") AND (ProductType <> "3")
Any Windows Desktop OS – 32-bit
SELECT * FROM Win32_OperatingSystem WHERE ProductType = "1" AND NOT OSArchitecture = "64-bit"
Any Windows Desktop OS – 64-bit
SELECT * FROM Win32_OperatingSystem WHERE ProductType = "1" AND OSArchitecture = "64-bit"

Windows Server Operating Systems:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Any Windows Server OS
SELECT * FROM Win32_OperatingSystem WHERE (ProductType = "2") OR (ProductType = "3")
Any Windows Server OS – 32-bit
SELECT * FROM Win32_OperatingSystem WHERE (ProductType = "2") OR (ProductType = "3") AND NOT OSArchitecture = "64-bit"
Any Windows Server OS – 64-bit
SELECT * FROM Win32_OperatingSystem WHERE (ProductType = "2") OR (ProductType = "3") AND OSArchitecture = "64-bit"
Any Windows Server – DOMAIN Controller
SELECT * FROM Win32_OperatingSystem WHERE (ProductType = "2")
Any Windows Server – DOMAIN Controller – 32-bit
SELECT * FROM Win32_OperatingSystem WHERE (ProductType = "2") AND NOT OSArchitecture = "64-bit"
Any Windows Server – DOMAIN Controller – 64-bit
SELECT * FROM Win32_OperatingSystem WHERE (ProductType = "2") AND OSArchitecture = "64-bit"
Any Windows Server – Non-DOMAIN Controller
SELECT * FROM Win32_OperatingSystem WHERE (ProductType = "3")
Any Windows Server – Non- DOMAIN Controller – 32-bit
SELECT * FROM Win32_OperatingSystem WHERE (ProductType = "3") AND NOT OSArchitecture = "64-bit"
Any Windows Server – Non-DOMAIN Controller – 64-bit
SELECT * FROM Win32_OperatingSystem WHERE (ProductType = "3") AND OSArchitecture = "64-bit"

Individual Product Versions:

Windows XP / NT 5.1

1
2
3
4
5
6
Any version OF Windows XP
SELECT * FROM Win32_OperatingSystem WHERE (Version LIKE "5.1%" OR Version LIKE "5.2%") AND ProductType="1"
Windows XP – 32-bit
SELECT * FROM Win32_OperatingSystem WHERE (Version LIKE "5.1%" OR Version LIKE "5.2%") AND ProductType="1" AND NOT OSArchitecture = "64-bit"
Windows XP – 64-bit
SELECT * FROM Win32_OperatingSystem WHERE (Version LIKE "5.1%" OR Version LIKE "5.2%") AND ProductType="1" AND OSArchitecture = "64-bit"

Windows Vista / NT 6.1

1
2
3
4
5
6
Any Version OF Windows Vista
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.0%" AND ProductType="1"
Windows Vista – 32-bit
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.0%" AND ProductType="1" AND NOT OSArchitecture = "64-bit"
Windows Vista – 64-bit
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.0%" AND ProductType="1" AND OSArchitecture = "64-bit"

Windows 7

1
2
3
4
5
6
Any version OF Windows 7
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.1%" AND ProductType="1"
Windows 732-bit
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.1%" AND ProductType="1" AND NOT OSArchitecture = "64-bit"
Windows 764-bit
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.1%" AND ProductType="1" AND OSArchitecture = "64-bit"

Windows 8

1
2
3
4
5
6
Any Version OF Windows 8
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.2%" AND ProductType="1"
Windows 832-bit
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.2%" AND ProductType="1" AND NOT OSArchitecture = "64-bit"
Windows 864-bit
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.2%" AND ProductType="1" AND OSArchitecture = "64-bit"

Windows 8.1

1
2
3
4
5
6
Any version OF Windows 8.1
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.3%" AND ProductType="1"
Windows 8.132-bit
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.3%" AND ProductType="1" AND NOT OSArchitecture = "64-bit"
Windows 8.164-bit
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.3%" AND ProductType="1" AND OSArchitecture = "64-bit"

Windows 10

1
2
3
4
5
6
Any version OF Windows 8.1
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "10%" AND ProductType="1"
Windows 8.132-bit
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "10%" AND ProductType="1" AND NOT OSArchitecture = "64-bit"
Windows 8.164-bit
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "10%" AND ProductType="1" AND OSArchitecture = "64-bit"

Windows Server 2003

1
2
3
4
5
6
7
8
9
10
11
12
Windows Server 2003 – DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "5.2%" AND ProductType="2"
Windows Server 2003 – non-DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "5.2%" AND ProductType="3"
Windows Server 200332-bit – DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "5.2%" AND ProductType="2" AND NOT OSArchitecture = "64-bit"
Windows Server 200332-bit – non-DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "5.2%" AND ProductType="3" AND NOT OSArchitecture = "64-bit"
Windows Server 200364-bit – DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "5.2%" AND ProductType="2" AND OSArchitecture = "64-bit"
Windows Server 200364-bit – non-DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "5.2%" AND ProductType="3" AND OSArchitecture = "64-bit"

Windows Server 2003 R2

1
2
3
4
5
6
7
8
9
10
11
12
Windows Server 2003 R2 – DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "5.2.3%" AND ProductType="2"
Windows Server 2003 R2 – non-DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "5.2.3%" AND ProductType="3"
Windows Server 2003 R2 – 32-bit – DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "5.2.3%" AND ProductType="2" AND NOT OSArchitecture = "64-bit"
Windows Server 2003 R2 – 32-bit – non-DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "5.2.3%" AND ProductType="3" AND NOT OSArchitecture = "64-bit"
Windows Server 2003 R2 – 64-bit – DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "5.2.3%" AND ProductType="2" AND OSArchitecture = "64-bit"
Windows Server 2003 R2 – 64-bit – non-DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "5.2.3%" AND ProductType="3" AND OSArchitecture = "64-bit"

Windows Server 2008

1
2
3
4
5
6
7
8
9
10
11
12
Windows Server 2008 – DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.0%" AND ProductType="2"
Windows Server 2008 – non-DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.0%" AND ProductType="3"
Windows Server 200832-bit – DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.0%" AND ProductType="2" AND NOT OSArchitecture = "64-bit"
Windows Server 200832-bit – non-DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.0%" AND ProductType="3" AND NOT OSArchitecture = "64-bit"
Windows Server 200864-bit – DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.0%" AND ProductType="2" AND OSArchitecture = "64-bit"
Windows Server 200864-bit – non-DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.0%" AND ProductType="3" AND OSArchitecture = "64-bit"

Windows Server 2008 R2

1
2
3
4
Windows Server 2008 R2 – 64-bit – DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.1%" AND ProductType="2"
Windows Server 2008 R2 – 64-bit – non-DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.1%" AND ProductType="3"

Windows Server 2012

1
2
3
4
Windows Server 201264-bit – DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.2%" AND ProductType="2"
Windows Server 201264-bit – non-DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.2%" AND ProductType="3"

Windows Server 2012 R2

1
2
3
4
Windows Server 2012 R2 – 64-bit – DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.3%" AND ProductType="2"
Windows Server 2012 R2 – 64-bit – non-DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "6.3%" AND ProductType="3"

Windows Server 2016

1
2
3
4
Windows Server 201664-bit – DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "10.0%" AND ProductType="2"
Windows Server 201664-bit – non-DC
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "10.0%" AND ProductType="3"

Windows Server 2019

1
SELECT * FROM Win32_OperatingSystem WHERE Caption LIKE “%Windows Server 2019%”

Deprecated Query:

Select * from Win32_OperatingSystem WHERE BuildNumber >= 17763 and (ProductType=”3″ or ProductType=”2″)

More Advanced Types of WMI Queries

Lima

About the author

Lima is the visual nautical indicator for "stop instantly."

Comments

  1. Thanks for the info, but your Windows Server 2019 WMI Filter does not work properly. I tried it against a 2012 R2 server and it came back “true”. This is because the build number field is a string. I am instead using this:
    SELECT * FROM Win32_OperatingSystem Where Caption like “%Windows Server 2019%”

  2. Server 2019 also has a version number of 10.0.xxx so it’s probably best to use the Caption Like in the 2016 filter as well. The WMI of 2016 is also True on a 2019 server now

Leave a Reply

%d bloggers like this: