Windows Operating System WMI Filter Queries

WINDOWS CLIENT

Windows XP

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

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

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

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"

Windows 10 RTM (32-bit)

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

Windows 10 RTM (64-bit)

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

Windows 10 1511 (32-bit)

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

Windows 10 1511 (64-bit)

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

Windows 10 1607 (Anniversary Update) (32-bit)

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

Windows 10 1607 (Anniversary Update) (64-bit)

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

Windows 10 1703 (Creators Update) (32-bit)

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

Windows 10 1703 (Creators Update) (64-bit)

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

 

WINDOWS SERVER

Windows Server 2003

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

Windows Server 2003 (Domain Controller)

select * from Win32_OperatingSystem WHERE Version like "5.2%" AND ProductType="2"

Windows Server 2003 R2

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

Windows Server 2003 R2 (Domain Controller)

select * from Win32_OperatingSystem WHERE Version like "5.2.3%" AND ProductType="2"

Windows Server 2008

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

Windows Server 2008 (Domain Controller)

select * from Win32_OperatingSystem WHERE Version like "6.0%" AND ProductType="2"

Windows Server 2008 (32-bit)

select * from Win32_OperatingSystem WHERE Version like "6.0%" AND ProductType="3" AND NOT OSArchitecture = "64-bit"

Windows Server 2008 (32-bit,  Domain Controller)

select * from Win32_OperatingSystem WHERE Version like "6.0%" AND ProductType="2" AND NOT OSArchitecture = "64-bit"

Windows Server 2008 (64-bit)

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

Windows Server 2008 (64-bit,  Domain Controller)

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

Windows Server 2008 R2 (64-bit)

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

Windows Server 2008 R2 (64-bit, Domain Controller)

select * from Win32_OperatingSystem WHERE Version like "6.1%" AND ProductType="2"

Windows Server 2012 (64-bit)

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

Windows Server 2012 (64-bit, Domain Controller)

select * from Win32_OperatingSystem WHERE Version like "6.2%" AND ProductType="2"

Windows Server 2012 R2 (64-bit)

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

Windows Server 2012 R2 (64-bit, Domain Controller)

select * from Win32_OperatingSystem WHERE Version like "6.3%" AND ProductType="2"

/ JC

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

9 Responses to Windows Operating System WMI Filter Queries

  1. Adm says:

    OSArchitecture variable does’t work in Win2003 and WinXP.

  2. adjectivity says:

    I got a syntax error when I copy and pasted this text (select * from Win32_OperatingSystem WHERE Version like “6.3%” AND ProductType=”1″ ) into Group Policy. This didn’t occur when I copied the Windows 10 version ( select * from Win32_OperatingSystem WHERE Version like “10.0%” AND ProductType=”1″ ) It did work when I copied and changed the values from the Windows 10 string. The only difference that I could detect in Notepad was the quotation marks. They are visibly different.

    • jonconwayuk says:

      Hi – you’re absolutely correct. You need to use “straight” quotes in scripts and WMI queries rather than the “curly” ones you get when editing in programs such as Microsoft Word. These queries were cut and pasted from Notepad++ which only uses straight quotes so I can only assume that WordPress has altered the format somehow when I’ve added the post. Indeed if I paste my post into notepad.exe they all show as straight. I’ll update the post to state for people to use straight quotes!

  3. adjectivity says:

    It does appear that the quotes are at fault. It is probably a ANSI vs Unicode thing. I copied the existing quotation marks into Replace All and typed the default quotation marks to fix this. No more syntax errors. This is on Server 2012 and Windows 10 Pro.

  4. jonconwayuk says:

    Post updated to use code formatting so hopefully copy and paste will now carry over the correct type of quotes.

  5. GovGeek says:

    Nice article. Adding an Edition (like Professional or Enterprise) would be great!

  6. Danno says:

    Awesome work dude. Help me out a massive bunch.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s