Windows WMI Filter Query Beispiele für Gruppenrichtlinien

Problem

Sie suchen WMI Filter Queries für Ihre Gruppenrichtlinien?

Lösung

Queries in WMI Filter sind eine sehr nützliche Sache um beispielsweise Gruppenrichtlinien (GPO) filtern zu können. Allerdings auch an vielen anderen Stellen unter Windows kann man sich mit WMI Filtern gut behelfen. Ich habe hier eine Liste praktischer WMI Filter zusammen gestellt mit deren Queries ich die meiste Zeit zu tun habe.

Tipp:
Ab Windows 10 bzw. Windows Server 2016, lauten die System-Versionsnummern „10.0.xxxxx“. Viele im Internet kursierende Queries verwenden diese Build- oder Versions-Nummern in Abfragen. Da sich aufgrund der Release-Updates die Versionssnummern bzw. BuildNummern im Vergleich zu früher weitaus öfters ändern, ist es "ab jetzt" eher ratsam, anstelle von Versions- oder Build-Nummern den Systemnamen (Caption) in Queries abzufragen. Dieser bleibt unabhängig von Versions-Nummern bestehen. Ein Beispiel für einen Caption ist "Microsoft Windows 10 Pro". Sie können den Caption Ihres Systems mit folgendem Befehl abfragen:
wmic os get caption /format:list

In den Query Beispielen sind bewusst an manchen Stellen Abfragen aus anderen WMI Aliasen oder Verneinungen verwendet worden um die flexibilität ein bisschen zu demonstrieren.

WMI Query Beispiele - Allgemein

Beschreibung

Query

Nur Notebooks/Mobiles

SELECT * FROM Win32_ComputerSystem WHERE PCSystemType="2"

Nur Desktops

SELECT * FROM Win32_ComputerSystem WHERE PCSystemType="1"

Computer in Gruppe XY

SELECT * FROM Win32_Group WHERE Domain = "dom.local" and Name="MyGroupName"

Ab Win7 mit 32 Bit

SELECT * FROM Win32_OperatingSystem WHERE (Version>="6.%" AND Producttype="1" AND OSArchitecture="32-bit")

32 Bit OS

SELECT AddressWidth FROM Win32_Processor WHERE AddressWidth="32"

64 Bit OS

SELECT AddressWidth FROM Win32_Processor WHERE AddressWidth="64"

Windows 7

SELECT * FROM Win32_OperatingSystem WHERE Version like "6.%" 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 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 10

SELECT * FROM Win32_OperatingSystem WHERE Version like "10.%" AND ProductType="1"

Windows 10 32 Bit

SELECT * FROM Win32_OperatingSystem WHERE Version like "10.%" AND ProductType="1" AND OSArchitecture="32-bit"

Windows 10 64 Bit

SELECT * FROM Win32_OperatingSystem WHERE Version like "10.%" AND ProductType="1" AND OSArchitecture="64-bit"

Windows 10 64 Bit (Caption)

SELECT * FROM Win32_OperatingSystem WHERE Caption like "%Windows 10%" AND OSArchitecture="64-bit"

Windows 10 32 Bit (Caption)

SELECT * FROM Win32_OperatingSystem WHERE Caption like "%Windows 10%" AND OSArchitecture="32-bit"

Windows 10 alle (Caption)

SELECT * FROM Win32_OperatingSystem WHERE Caption like "%Windows 10%"

Computername nicht gleich XY

SELECT * FROM Win32_ComputerSystem WHERE not Name like "%ComputerXY%" AND not Name like "%SomeOtherName%"

 

WMI Query Beispiele - Server bezogen

SERVER

 

2008 Server

SELECT * FROM Win32_OperatingSystem WHERE Version like "6.0%" AND (ProductType="2" OR Producttype="3")

2008R2 Server

SELECT * FROM Win32_OperatingSystem WHERE Version like "6.1%" AND (ProductType="2" OR Producttype="3")

2008 – 2012R2 Server

SELECT * FROM Win32_OperatingSystem WHERE Version like "6.%" AND (ProductType="2" OR ProductType="3")

2012 Server

SELECT * FROM Win32_OperatingSystem WHERE Version like "6.2%" AND (ProductType="2" OR ProductType="3")

2012R2 Server

SELECT * FROM Win32_OperatingSystem WHERE Version like "6.3%" AND (ProductType="2" OR ProductType="3")

2016-2019 DCs

SELECT * FROM Win32_OperatingSystem WHERE Version like "10.%" AND ProductType="2"

2016-2019 Member Server

SELECT * FROM Win32_OperatingSystem WHERE Version like "10.%" AND ProductType="3"

2016-2019 Server

SELECT * FROM Win32_OperatingSystem WHERE Version like "10.%" AND (ProductType="2" OR Producttype="3")

2016 Server

SELECT * from Win32_OperatingSystem WHERE Caption like "%2016%" AND (ProductType="3" OR ProductType="2")

2016 Member Server

SELECT * from Win32_OperatingSystem WHERE Caption like "%2016%" AND ProductType="3"

2016 DCs

SELECT * from Win32_OperatingSystem WHERE Caption like "%2016%" AND ProductType="2"

2019 Server Built 17763 (ver 1809)

SELECT * from Win32_OperatingSystem WHERE BuildNumber=17763 AND (ProductType="3" OR ProductType="2")

2019 Server

SELECT * from Win32_OperatingSystem WHERE Caption like "%2019%" AND (ProductType="3" OR ProductType="2")

Member Server

SELECT * FROM Win32_OperatingSystem WHERE ProductType="3"

Domain Controller

SELECT * FROM Win32_OperatingSystem WHERE ProductType="2"

Server

SELECT * from Win32_OperatingSystem WHERE (ProductType="3" OR ProductType="2")

 

Weiterführende Informationen

 

Derzeitige Windows Versions- bzw. Build-Nummern

Operating System

Version / Build

Date

SERVER

   

Windows Server 2003 (Beta?)

5.2.3763

 

Windows Server 2003

5.2.3790

24.04.2003

Windows Server 2003, Service Pack 1

5.2.3790.1180

 

Windows Server 2003

5.2.3790.1218

 

Windows Home Server

5.2.3790

16.06.2007

Windows Server 2008

6.0.6001

27.02.2008

Windows Server 2008 R2, RTM (Release to Manufacturing)

6.1.7600.16385

22.10.2009

Windows Server 2008 R2, SP1

6.1.7601

 

Windows Home Server 2011

6.1.8400

05.04.2011

Windows Server 2012

6.2.9200

04.09.2012

Windows Server 2012 R2

6.3.9200

18.10.2013

Windows Server 2016 (1607)

10.0.14393

26.09.2016

Windows Server 2016 (1709)

10.0.16299

17 October 2017

Windows Server 2016 (1803)

10.0.17134

30 April 2018

Windows Server 2019

10.0.17677

2018

     

CLIENTS

   

Windows 2000 (Beta 3)

5.00.2031

 

Windows 2000 (Beta 3 RC2)

5.00.2128

 

Windows 2000 (Beta 3)

5.00.2183

 

Windows 2000

5.00.2195

17.02.2000

Windows XP (RC 1)

5.1.2505

 

Windows XP

5.1.2600

25.10.2001

Windows XP, Service Pack 1

5.1.2600.1105-1106

 

Windows XP, Service Pack 2

5.1.2600.2180

 

Windows XP, Service Pack 3

5.1.2600

21.04.2008

Windows Vista, Beta 1

6.0.5112

20.07.2005

Windows Vista, Community Technology Preview (CTP)

6.0.5219

30.08.2005

Windows Vista, TAP Preview

6.0.5259

17.11.2005

Windows Vista, CTP (Dezember)

6.0.5270

14.12.2005

Windows Vista, CTP (Februar)

6.0.5308

17.02.2006

Windows Vista, CTP (Refresh)

6.0.5342

21.03.2006

Windows Vista, April EWD

6.0.5365

19.04.2006

Windows Vista, Beta 2 Previw

6.0.5381

01.05.2006

Windows Vista, Beta 2

6.0.5384

18.05.2006

Windows Vista, Pre-RC1

6.0.5456

20.06.2006

Windows Vista, Pre-RC1, Build 5472

6.0.5472

13.07.2006

Windows Vista, Pre-RC1, Build 5536

6.0.5536

21.08.2006

Windows Vista, RC1

6.0.5600.16384

29.08.2006

Windows Vista, Pre-RC2

6.0.5700

10.08.2006

Windows Vista, Pre-RC2, Build 5728

6.0.5728

17.09.2006

Windows Vista, RC2

6.0.5744.16384

03.10.2006

Windows Vista, Pre-RTM, Build 5808

6.0.5808

12.10.2006

Windows Vista, Pre-RTM, Build 5824

6.0.5824

17.10.2006

Windows Vista, Pre-RTM, Build 5840

6.0.5840

18.10.2006

Windows Vista, RTM (Release to Manufacturing)

6.0.6000.16386

01.11.2006

Windows Vista

6.0.6000

08.11.2006

Windows Vista, Service Pack 2

6.0.6002

04.02.2008

Windows 7, RTM (Release to Manufacturing)

6.1.7600.16385

22.10.2009

Windows 7

6.1.7600

22.10.2009

Windows 7, Service Pack 1

6.1.7601

 

Windows 8

6.2.9200

26.10.2012

Windows Phone 8

6.2.10211

29.10.2012

Windows 8.1

6.3.9200

17.10.2013

Windows 8.1, Update 1

6.3.9600

08.04.2014

Windows 10 (1507)

10.0.10240

29.07.2015

Windows 10 (1511)

10.0.10586

10.11.2015

Windows 10 (1607)

10.0.14393

02.08.2016

Windows 10 (1703)

10.0.15063

05.04.2017

Windows 10 (1709)

10.0.16299

17.10.2017

Windows 10 (1803)

10.0.17134

30.04.2018

Windows 10 (1809)

10.0.17763

02.10.2018

Windows 10 (1903)

10.0.18362

19.05.2019

Windows 10 (1909) 10.0.18363 12.11.2019
Windows 10 (2004) n/v n/v

 

ProductType Werte (Alias win32_operatingsystem)

Value

Version

1

Client versions of Windows

2

Server versions of Windows that are operating as a domain controller

3

Server versions of Windows that are not operating as a domain controller (typically referred to as member servers)

 

PCSystemType Werte (Alias win32_computersystem)

Value

System Type

0

Unspecified

1

Desktop

2

Mobile

3

Workstation

4

Enterprise Server

5

Small Office and Home Office (SOHO) Server

6

Appliance PC

7

Performance Server

8

Maximum

 

 


Print