Windows 2003 – Group Policy WMI Filters

GPO WMI Filter Examples

WMI Filters allow you to select only computers that meet your chosen criteria.  Naturally, your Group Policy will only apply to the objects that match your filter. For example, you want to assign an .MSI package, however you are worried that disks on the XP workstations are full.  The answer is design and build a WMI filter.

WMI Filter Topics

  ‡

Creating WMI GPO Filters

Building WMI filters is a multi skilled task.  You need to marry Group Policy skills with WMI knowledge.  You also need to research which of Microsoft’s Win32_Classes are suitable for a WQL (Windows Query Language) query.  As far as Group Policy skills are concerned there is a two stage process, creating the filter with its WQL query, then assigning, or wiring up the filter to the appropriate Group Policy object.

WMI Filter for Group Policy

WMI GPO Filter Example #1

Below is a WMI filter which checks the free disk space on the C: drive.

SELECT * FROM Win32_LogicalDisk WHERE (Name = " C:") AND
DriveType = 3 AND FreeSpace > 20000000 AND FileSystem = " NTFS"

Note 1: DriveType value = 3 means a local disk
Note 2: 20000000 = 20MB.
Note 3: Your Keyword – Win32_LogicalDisk

Guy Recommends: WMI Monitor and It’s Free!Solarwinds Free WMI Monitor

Windows Management Instrumentation (WMI) is one of the hidden treasures of Microsoft’s operating systems.  Fortunately, SolarWinds have created a Free WMI Monitor so that you can discover these gems of performance information, and thus improve your scripts.

Take the guess work out of which WMI counters to use when scripting the operating system, Active Directory or Exchange Server. Give this WMI monitor a try – it’s free.

Download your free copy of WMI Monitor

WMI GPO Filter Example #2

Here the WMI filter checks that the Operating System Name is XP and not Windows Server 2003.

Select * from Win32_OperatingSystem where Caption = " Microsoft Windows XP Professional"

Note 1: The Keyword is Win32_OperatingSystem

WMI GPO Filter Example #3

A WMI filter for Windows 7

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

Note 1:  The Keyword is Win32_OperatingSystem

Note 2:  6.0% would be Vista

In truth you need to be a minor expert on WMI interface to create your own WMI filters from scratch.  To understand more about WMI and VBScript, check out this complete section.

Other Ideas for Criteria

  • Hardware – Pentium 4 or later
  • Service packs – SP1 or later.  Also for operating system hot fixes
  • DHCP – Service
  • Fancy criteria e.g. Registry settings or even event log ID
  • Time Zones

Where to Apply WMI Filters

GPO WMI Filter Example

Once again, use the Microsoft GPMC to manage the Group Policy task.  The WMI filters have their own folder where you design and build the queries. 

Then you link the filter to the appropriate Group Policy via the drop down box on the very bottom right of the diagram.

How the Filters Work

A WMI filter consists a query that is checked against the WMI data on the target machine, the answer is always true or false.  Technically, you have created a separate object from the GPO in the directory.  To apply it to a GPO, you link the filter to the GPO.  This is shown in the WMI filtering section on the Scope tab of a GPO.  Each GPO can have only one WMI filter; however the same WMI filter can be linked to multiple GPOs.

Note that these WMI filters only work on Windows XP and later operating systems. Incidentally, Windows 2000 and earlier clients just ignore any WMI filter and the GPO is always applied to all objects.  In effect it means that for these old clients the criteria are always true so there is no filtering.

Summary of GPO WMI Filters

Here is a great idea to fine tune your Microsoft Group Policy and only apply the settings where there is sufficient disk space.  WMI filters are limited only be your imagination, or your knowledge of WMI’s Win32_Classes.


Group Policy ebook Windows 2003Download my ‘Master Group Policies’ ebook only $6.25

The extra features you get in your eBook include: Spreadsheet with over 850 policies.  Printer friendly version over Word A4 pages in Word.


See more Group Policies for Windows Users

Group Policies   •GPO Internet Explorer   • Group Policy Block Inheritance   •Logon Script Policies

Start Menu Group Policies   • Network Policies  •GPMC   •Troubleshooting Group Policies

Group Policy Overview  •Group Policy Results  • System Group Policies   • Software Installation

If you like this page then please share it with your friends