Updated List of OS Version Queries for WMI Filters

Group PolicyMore likely than not, if you’re using Group Policy to push out software installation or registry entries to client machines or servers on the domain, the policy may be different depending on the OS version or architecture.

Examples, Group Policy Objects may need to be filtered by:

  • Desktop / Server
  • Domain Controller / Non-Domain Controller
  • 32-bit / 64-bit

If you haven’t used WMI filters before, they show up in Group Policy Management at the bottom, between Group Policy Objects and Starter GPOs.

Common OS WMI Filters

The WMI filters use a query to scope down the application of the Group Policy Object applicability. Here’s what a typical WMI OS filter looks like:

WMI filter

select * from Win32_OperatingSystem WHERE Version like "6.1%" AND ProductType="1" AND OSArchitecture = "64-bit"

WMI Win32_OperatingSystem ProductType Tips:

ProductType 1 = Desktop OS

ProductType 2 = Server OS – Domain Controller

ProductType 3 = Server OS – Not a Domain Controller

WMI Win32_OperatingSystem Version Number Tips:

5.1 – Windows XP

5.2 – Windows Server 2003

5.2.3 – Windows Server 2003 R2

6.0 – Windows Vista & Windows Server 2008

6.1 – Windows 7 & Windows Server 2008 R2

6.2 – Windows 8 & Windows Server 2012

6.3 – Windows 8.1 & Windows Server 2012 R2

To create your own WMI filters, here is an updated list of WMI filter queries from Window XP – Windows 8.1 and from Server 2003 to Server 2012 R2.

IMPORTANT DISCLAIMER:
Always test your Group Policies and WMI filters before deploying.

DESKTOPS

ANY WINDOWS DESKTOP OS

  • 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 XP

  • 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

  • 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

  • Windows 7
    select * from Win32_OperatingSystem WHERE Version like "6.1%" AND ProductType="1"
  • Windows 7 – 32-bit
    select * from Win32_OperatingSystem WHERE Version like "6.1%" AND ProductType="1" AND NOT OSArchitecture = "64-bit"
  • Windows 7 – 64-bit
    select * from Win32_OperatingSystem WHERE Version like "6.1%" AND ProductType="1" AND OSArchitecture = "64-bit"

WINDOWS 8

  • Windows 8
    select * from Win32_OperatingSystem WHERE Version like "6.2%" AND ProductType="1"
  • Windows 8 – 32-bit
    select * from Win32_OperatingSystem WHERE Version like "6.2%" AND ProductType="1" AND NOT OSArchitecture = "64-bit"
  • Windows 8 – 64-bit
    select * from Win32_OperatingSystem WHERE Version like "6.2%" AND ProductType="1" AND OSArchitecture = "64-bit"

WINDOWS 8.1

  • Windows 8.1
    select * from Win32_OperatingSystem WHERE Version like "6.3%" AND ProductType="1"
  • Windows 8.1 – 32-bit
    select * from Win32_OperatingSystem WHERE Version like "6.3%" AND ProductType="1" AND NOT OSArchitecture = "64-bit"
  • Windows 8.1 – 64-bit
    select * from Win32_OperatingSystem WHERE Version like "6.3%" AND ProductType="1" AND OSArchitecture = "64-bit"

 

SERVERS

ANY WINDOWS SERVER OS

  • 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"

WINDOWS SERVER 2003

  • 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 2003 – 32-bit – DC
    select * from Win32_OperatingSystem WHERE Version like "5.2%" AND ProductType="2" AND NOT OSArchitecture = "64-bit"
  • Windows Server 2003 – 32-bit – non-DC
    select * from Win32_OperatingSystem WHERE Version like "5.2%" AND ProductType="3" AND NOT OSArchitecture = "64-bit"
  • Windows Server 2003 – 64-bit – DC
    select * from Win32_OperatingSystem WHERE Version like "5.2%" AND ProductType="2" AND OSArchitecture = "64-bit"
  • Windows Server 2003 – 64-bit – non-DC
    select * from Win32_OperatingSystem WHERE Version like "5.2%" AND ProductType="3" AND OSArchitecture = "64-bit"

WINDOWS SERVER 2003 R2

  • 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

  • Windows Server 2008DC
    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 2008 – 32-bit – DC
    select * from Win32_OperatingSystem WHERE Version like "6.0%" AND ProductType="2" AND NOT OSArchitecture = "64-bit"
  • Windows Server 2008 – 32-bit – non-DC
    select * from Win32_OperatingSystem WHERE Version like "6.0%" AND ProductType="3" AND NOT OSArchitecture = "64-bit"
  • Windows Server 2008 – 64-bit – DC
    select * from Win32_OperatingSystem WHERE Version like "6.0%" AND ProductType="2" AND OSArchitecture = "64-bit"
  • Windows Server 2008 – 64-bit – non-DC
    select * from Win32_OperatingSystem WHERE Version like "6.0%" AND ProductType="3" AND OSArchitecture = "64-bit"

WINDOWS SERVER 2008 R2

  • 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

  • Windows Server 2012 – 64-bit – DC
    select * from Win32_OperatingSystem WHERE Version like "6.2%" AND ProductType="2"
  • Windows Server 2012 – 64-bit – non-DC
    select * from Win32_OperatingSystem WHERE Version like "6.2%" AND ProductType="3"

WINDOWS SERVER 2012 R2

  • 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"
VN:F [1.9.20_1166]
Rating: 9.8/10 (74 votes cast)
Updated List of OS Version Queries for WMI Filters, 9.8 out of 10 based on 74 ratings

27 Replies to “Updated List of OS Version Queries for WMI Filters”

  1. Is there anyway to use a WMI filter to check for a 64bit install of Office? (2007, 2010 and 2013)

    We have an Outlook plugin that needs to be pushed out with GPO, it come sin 32 and 64 bit flavours. Thus I need a Policy to push the 64bit plugin to the 64bit Outlook installs.

    Is this even possible? I have come across a few options like:
    select * from Win32_Service where Name ="ose64"
    But that does not seem to detect a 64bit office install.

    Thanks in advance!

    1. I found this on the web which might help: http://social.msdn.microsoft.com/Forums/office/en

      SELECT * FROM Win32_Product WHERE (Caption LIKE "Microsoft Office %2007%") OR (Caption LIKE "Microsoft Office %2010%") //look if office 2007 or 2010 is instald.

      select * from Win32_Service where Name = "ose64"" ////for office 64bit

      select * from Win32_Service where Name = "ose"" //// for office 32 bit

      Select * from Win32_OperatingSystem Where Version Like "6.1.760%" and ProductType=1" ///aded check for windows 7 cliënt pc's

      1. DO NOT use the Win32_Product WMI Class. It takes a long time to enumerate anything as it has to sequentially go through all Windows Installer installed applications (anything installed via WMI). It also initiates a consistency check of all MSI installed applications, effectively running Verify and Repair on all packages.

        Read the Warning in the Remarks section – https://msdn.microsoft.com/en-us/library/aa394378

        Unfortunately, I do not have an appropriate alternative offhand. I would suggest using Group Policy Preferences (GPP) Client Side Targeting instead.

  2. Thanks for the info. Just a note: according to microsoft documentation the OSArchitecture value is not supported and does not exist in XP. The queries above would be invalid…

  3. The OSArchitecture attribute is NOT AVAILABLE with Server 2003 and XP.

    OSArchitecture
    Data type: string
    Access type: Read-only
    Architecture of the operating system, as opposed to the processor. This property can be localized.
    Example: 32-bit
    ****************************************************************************
    Windows Server 2003 and Windows XP: This property is not available.
    ****************************************************************************
    http://msdn.microsoft.com/en-us/library/aa394239(

  4. Hello, is there a way to use WMI filter to check for differents versions of the same OS? I would like to put different GPO settings based on if the version is Standard, Enterprise, Datacenter, etc.

  5. 0 (0x0)Standalone workstation
    1 (0x1)Member workstation
    2 (0x2)Standalone server
    3 (0x3)Member server
    4 (0x4)Backup Domain Controller
    5 (0x5)Primary Domain Controller

    select * from Win32_ComputerSystem where DomainRole=0

    1. I imagine Windows 10 would be:

      Windows 10
      select * from Win32_OperatingSystem WHERE Version like "6.4%" AND ProductType="1"

      Windows 10 – 32-bit
      select * from Win32_OperatingSystem WHERE Version like "6.4%" AND ProductType="1" AND NOT OSArchitecture = "64-bit"

      Windows 10 – 64-bit
      select * from Win32_OperatingSystem WHERE Version like "6.4%" AND ProductType="1" AND OSArchitecture = "64-bit"

      Seeing as the pattern was 6.0, 6.1, 6.2, etc going up with each O/S… However I could be wrong.

    2. If I understand the versioning numbers correct ( https://msdn.microsoft.com/en-us/library/windows/… ) it should be something, if not, like:

      Windows 10
      SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "10.0%" AND ProductType="1"

      Windows 10 – 32-bit
      SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "10.0%" AND ProductType="1" AND NOT OSArchitecture = "64-bit"

      Windows 10 64-bit
      SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "10.0%" AND ProductType="1" AND OSArchitecture = "64-bit"

    3. AFAIK Windows 10 has 10.X.X.X versions. So it will be something like:

      Server
      select * from Win32_OperatingSystem WHERE Version like "10%" AND ProductType="3"

      Client
      select * from Win32_OperatingSystem WHERE Version like "10%" AND ProductType="1"

  6. Here is what I use for Windows 10.
    select Version,ProductType from Win32_OperatingSystem where (Version="10.0.10240" or Version="10.0.10586") and ProductType=1
    You can use wildcards if you want, but I find them to slow down queries.
    select * from Win32_OperatingSystem where Version like "10.0%" and ProductType=1

  7. Hey,

    your XP Queries are not going to Work. OSArchitecture is unknown and cannot be processed.

    to find x86 XP Systems, use a WMI-Query with 2 conditions:

    select * from Win32_OperatingSystem WHERE (Version like "5.1%" or Version like "5.2%") AND ProductType="1"

    SELECT AddressWidth FROM Win32_Processor WHERE AddressWidth ='32'.

  8. windows 10 is the same as the windows 8 options, only change the Version to 10 instead of 6.3

    windows 10
    select * from Win32_OperatingSystem where Version like "10.%"
    windows 10 32bit
    select * from Win32_OperatingSystem WHERE Version like "10.%" AND ProductType="1" AND NOT OSArchitecture = "64-bit"
    windows 10 64bit
    select * from Win32_OperatingSystem WHERE Version like "10.%" AND ProductType="1" AND OSArchitecture = "64-bit"

  9. @Fred and the other 13. I would have thought its obvious to work out………….

    Windows 10

    Windows 10
    select * from Win32_OperatingSystem WHERE Version like "10.0%" AND ProductType="1"
    Windows 10 – 32-bit
    select * from Win32_OperatingSystem WHERE Version like "10.0%" AND ProductType="1" AND NOT OSArchitecture = "64-bit"
    Windows 10 – 64-bit
    select * from Win32_OperatingSystem WHERE Version like "10.0%" AND ProductType="1" AND OSArchitecture = "64-bit"

Leave a Reply