Precision in Group Policy application.
Published: Feb 05, 2025
Group Policy WMI Filtering is a powerful feature that allows administrators to apply Group Policy Objects (GPOs) and Group Policy preferences based on specific attributes of target computers, servers, and users. By leveraging Windows Management Instrumentation (WMI) queries, IT professionals can create highly targeted and dynamic GPOs that respond to the unique needs of their environment.
We’ll cover WMI Filtering, its benefits, setup, best practices, and troubleshooting tips. Whether you need to enhance security, streamline management, or customize user experiences, mastering WMI Filtering can significantly improve your Group Policy settings strategy.
Next, I’ll demonstrate how to create WMI Filters using the Group Policy Management Console (GPMC). But first, let me assist you in verifying you have all your ducks in a row before you start.
The only prerequisites are to have the necessary administrative privileges to create and edit GPOs and WMI Filters. Typically, you need to be in either Domain Admins or Group Policy Creator Owners group in Active Directory.
Also, ensure you have access to the Group Policy Management Console (GPMC) and can launch it.
There are several ways to open the GPMC, but the easiest method is to:
You probably noticed the ‘WMI Filters‘ category item on the left. Go ahead and click it. Based on your environment, you may or may not see any existing entries. Let’s create one right now to limit the application of a GPO to Windows 11 devices only.
We use ‘SQL’-like code, called WQL, to filter for specific criteria or attributes of devices.
To filter for all Windows 11 devices, we can use this query text:
SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "10.0.22000%" OR Version LIKE "10.0.22621%" OR Version LIKE "10.0.22631%" OR Version LIKE "10.0.26100%"
We’re reading the ‘Win32_OperatingSystem’ table and matching it against the internal version numbers of Windows 11 versions. Version 21H2, the initial version of Windows 11, is based on build 10.0.22000. And, jumping to the most recent, as of this writing, 10.0.26100 is based on Windows 11 24H2.
Of course, you can also use PowerShell to accomplish your duties related to WMI Filtering using New-GPWmiFilter. Let’s get started with a straightforward command to create a similar WMI Filter based on Windows 10.
New-GPWmiFilter -Name "Windows 10 Device Filter" -Description "This filter applies to all Windows 10 devices" -Query "SELECT * FROM Win32_OperatingSystem WHERE Version LIKE "10.% AND OperatingSystemSKU = 27"
Now that we have a new filter, how do we apply it? It’s quite simple.
When Group Policy is recalculated, and this specific GPO is read, it will only apply it if the Windows version of the device is ‘Windows 11.’ At that point, the specific settings in this policy related to the Start Menu and the Taskbar will apply.
In the wonderful aura of IT management, the ability to apply policies precisely and controlled is paramount. As environments grow more complex, a one-size-fits-all approach to policy application is less effective. This is where Group Policy WMI Filtering emerges as a critical tool for admins. If you need to target a specific computer, a specific browser, or specific aspects of network security, WMI Filters are for you.
Targeted policy application through WMI Filtering allows administrators to specify exactly which users and computers should receive particular GPOs based on various attributes and conditions. This precision ensures that policies are applied only where they are relevant and needed, enhancing security and efficiency. You can target desktop computers, Windows Server, and even virtual machines (VMs).
By leveraging WMI Filtering and WMI queries, administrators can create dynamic and flexible filters that respond to the unique characteristics of each target device, such as:
WMI Filtering is rather powerful – you can filter on all sorts of attributes of your devices like ‘Windows Server’, ‘Windows Vista’, ‘Windows XP’, ‘Domain Controllers’, and even ‘the correct version of Windows.’ You can also filter based on ’64-bit’ or ’32-bit’ operating systems.
You likely get the point; you can filter GPOs based on these high-level concepts. You want to make certain the correct GPO gets applied to the right workstation.
Let me list the major benefits of using WMI Filtering within Group Policy Management.
Before you launch into setting up WMI Filters in your environment, you should be accustomed to the following overall best practices. Read on to learn more.
Write Efficient Queries:
Plan and Document Your Filters:
Use Descriptive Names and Comments:
Here are a few more examples of using WMI Filters. First off, what if you needed to target devices with greater than 8 GB of RAM? Simple, use this query language:
SELECT * FROM Win32_ComputerSystem WHERE TotalPhysicalMemory > 8589934592
Another common distinction would be filtering out desktops and laptops. Use this query for that purpose:
SELECT * FROM Win32_SystemEnclosure WHERE ChassisTypes = 8
This will filter out the devices with a specific power management setting (in this case, “8”). This signifies a system enclosure type of ‘Laptop’.
Another powerful filter is the ‘producttype’ filter. This filter is used to target policies based on the type of Windows operating system on a computer. This filter checks the Win32_OperatingSystem class to determine whether the system is a workstation, domain controller, server, etc. You could set a WMI filter to ‘2’ and the resultant policy would only apply to servers configured as Domain Controllers.
In the context of this article, a single membership group refers to a WMI filter that targets devices based on their membership in a specific AD security group. The filter checks the ‘RSOP_SecurityGroupMembership’ class. This is helpful when setting up policies to only target often arbitrary devices in a single security group.
An article like this would be incomplete if it didn’t conclude with some troubleshooting tactics. Let me list the most common scenarios you’ll encounter when troubleshooting WMI Filters with Group Policy.
winmgmt /verifyrespository
winmgmt /salvagerepository
winmgmt /resetrepository
Please feel free to leave a comment or question!