Share via


Windows: Sample WMI Filter Strings

As an administrator we are tasked to do many things and items like group policy and WMI objects help greatly. However, not every Administrator has the confidence to use WMI filters. Below is a bunch of OS WMI filter strings that should help any Administrator in a pinch.

DESKTOPS

Version 1

select * from Win32_OperatingSystem WHERE ProductType = "1"

Version 2 (better for Win7 sometimes)

select * from Win32_OperatingSystem WHERE (ProductType <> "2") AND (ProductType <> "3")

32-bit

select * from Win32_OperatingSystem WHERE ProductType = "1" AND NOT OSArchitecture = "64-bit"

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"

32-bit

select * from Win32_OperatingSystem WHERE (Version like "5.1%" or Version like "5.2%") AND ProductType="1" AND NOT OSArchitecture = "64-bit"

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"

32-bit

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

64-bit

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

WINDOWS 7

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

 32-bit

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

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"

32-bit

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

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"

32-bit

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

64-bit

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

Windows 10

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

32-bit

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

64-bit

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

SERVERS

select * from Win32_OperatingSystem where (ProductType = "2") OR (ProductType = "3")

32-bit

select * from Win32_OperatingSystem where (ProductType = "2") OR (ProductType = "3") AND NOT OSArchitecture = "64-bit"

64-bit

select * from Win32_OperatingSystem where (ProductType = "2") OR (ProductType = "3") AND OSArchitecture = "64-bit"

Domain Controller

select * from Win32_OperatingSystem where (ProductType = "2")

32-bit

select * from Win32_OperatingSystem where (ProductType = "2") AND NOT OSArchitecture = "64-bit"

64-bit

select * from Win32_OperatingSystem where (ProductType = "2") AND OSArchitecture = "64-bit"

Non-Domain Controller

select * from Win32_OperatingSystem where (ProductType = "3")

32-bit

select * from Win32_OperatingSystem where (ProductType = "3") AND NOT OSArchitecture = "64-bit"

64-bit

select * from Win32_OperatingSystem where (ProductType = "3") AND OSArchitecture = "64-bit"

WINDOWS SERVER 2003

DC

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

non-DC

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

32-bit – DC

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

32-bit – non-DC

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

64-bit – DC

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

64-bit – non-DC

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

WINDOWS SERVER 2003 R2

DC

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

non-DC

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

32-bit – DC

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

32-bit – non-DC

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

64-bit – DC

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

64-bit – non-DC

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

WINDOWS SERVER 2008

DC

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

non-DC

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

32-bit – DC

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

32-bit – non-DC

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

64-bit – DC

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

64-bit – non-DC

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

WINDOWS SERVER 2008 R2

64-bit – DC

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

64-bit – non-DC

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

WINDOWS SERVER 2012

64-bit – DC

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

64-bit – non-DC

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

WINDOWS SERVER 2012 R2

64-bit – DC

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

64-bit – non-DC

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

Detect device by type

Desktop

Select * from Win32_ComputerSystem WHERE (PCSystemType = 1)

Mobile / Laptop

Select * from Win32_ComputerSystem WHERE (PCSystemType = 2)

Workstation

Select * from Win32_ComputerSystem WHERE (PCSystemType = 3)

Enterprise Server

Select * from Win32_ComputerSystem WHERE (PCSystemType = 4)

Small Office and Home Office (SOHO) Server

Select * from Win32_ComputerSystem WHERE (PCSystemType = 5)

Appliance PC

Select * from Win32_ComputerSystem WHERE (PCSystemType = 6)

Performance Server

Select * from Win32_ComputerSystem WHERE (PCSystemType = 7)