DiscoPosse – Using the chicken to measure IT
Technology, Cycling, Music and Madness


Technology

October 29, 2011

Group Policy – WMI Filters by Operating System

More articles by »
Written by: Eric
Tags:

Have you ever wanted to separate your Active Directory Group Policies from each other based on criteria such as target operating system? Well you are in luck! With some very simple WMI filters you can do exactly that.

Using WMI filters is a simple, and flexible way to create specific target criteria for delivering policies. For my situation, I’d like to be able to create 3 specific policies so that I can ensure that there is no contamination of machines with the incorrect configuration.

We could achieve this using OU structure and manually moving around computer objects, but I would much rather be able to let the system do the heavy lifting and guarantee that I do not have any accidental policy delivery, or worse that no policies get deployed at all to the machines.

From a Domain Controller, or from a workstation running the Remote Server Administration Tools (RSAT), launch the Group Policy Management Console (Start | Administrative Tools | Group Policy Management) or by running GPMC.MSC from the Run command.

gpmc.msc

Expand the Forest and Domain until you will see the  WMI Filters folder towards the bottom of the list. Right click the WMI Filters folder and select New… to create a new filter.

Create new WMI Filter

The first policy we will create is one for Windows Server 2008. I do not need to differentiate between editions (Standard, Enterprise, Web) or chip architecture (x86 or x64) so my filter query will be for any version of Windows Server 2008.

The WMI property we are looking at for this is Caption from the Win32_OperatingSystem. You can look at yours using this simple PowerShell process:

     $wmi = gwmi Win32_OperatingSystem

     $wmi.Caption

PowerShell output

Let’s use the name Windows Server 2008 (all editions) for the name and description field of the new WMI Query

New WMI Filter dialog

Now click on the Add button which brings up the query window. Leave the Namespace as root\CIMv2 and then under the query section type this:

 Select * FROM Win32_OperatingSystem WHERE (Caption LIKE “Microsoft Windows Server 2008%”)

The by appending the % to the LIKE query it means that anything found after the 2008 in the Caption will be accepted. You can also use the Version property, but that is a number which is changed by Service Packs and can be more difficult to pinpoint. I’m only in need of knowing the OS type which makes it much easier to use the Caption.

WMI Query

Now that you’ve saved this new WMI filter, you can go to your Group Policy Object and on the Scope tab at the bottom you use the drop down list to apply your new WMI filter to the policy.

GPO wit Filter

For my other 2 queries, I use the same process but I want to have a Windows XP and a Windows 7 for managing my desktop pools with clearly targeted policies. For my Windows XP filter:

Select * FROM Win32_OperatingSystem WHERE (Caption LIKE “Microsoft Windows XP%”)

and for Windows 7:

Select * FROM Win32_OperatingSystem WHERE (Caption LIKE “Microsoft Windows 7%”)

It’s just that easy. Now go forth and filter!



About the Author

Eric





 
 

 
tovmug

Toronto VMUG: May 23rd, 2013 Event Recap and Private Cloud Presentation

It was a beautiful sunny morning in Toronto and a great day for a VMUG meeting! May 23rd brought the first VMUG meeting of the spring here and the audience showed that they were ready to show some community love today. There we...
by Eric
0

 
 
newfeature

VMware Hybrid Cloud Launch Day – Why this is important, and What is New

So today is a big announcement day for VMware. Not a total surprise of course, because they have teased this offering for a while, and they have actually had the system in customer beta testing for a while. I know, because I wa...
by Eric
0

 
 
mongodb

DiscoPosse Review: MongoDB Applied Design Patterns

That sound you hear is my mind being blown. Rick Copeland and the folks at O’Reilly have really put together a great book here. Admittedly, it was outside of my usual comfort zone because of the depth of the content, but ...
by Eric
0

 

 
coupling

Loose coupling – Winning strategy for hardware, software and processes

With all of the SDDC (Software Defined Data Center) and SDN (Software Defined Networking) coming into the fore these days, it is good to take a look at exactly why it is getting serious focus, and what particular qualities make...
by Eric
0

 
 
No, not radio controlled plane!

SDS? SDN? Understanding the Control Plane versus the Data Plane

In a Software Defined world, we are facing lots of new challenges with bringing people up to speed with the intricacies of what makes any of our core components “Software Defined”. With EMC bringing out their new Vi...
by Eric
0

 

 
vmworld2013

VMworld 2013 Session Voting is Open!

It’s that time of year again! VMworld 2013 is open for registration, and most importantly, the session content has been submitted and is open for voting. Thanks to Viewers Like You! There is an important theme here. The c...
by Eric
0

 



Join Zipcar and get $50 in free driving Join Zipcar and get $50 in free driving Join Zipcar and get $50 in free driving

3 Comments


  1. HardcoreITguy

    Keep in mind, there is a performance impact to WMI filters in a GPO. Every time GP processing runs (every ~90 min) it re-evaluates the WMI query…


  2. Excellent point. Touche! It’s a challenge to balance the win versus the performance hit.


  3. [...] a previous article about WMI filters for Group Policy, I identified simple filters to make sure that GPOs will only apply to machines running a specific [...]



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>