How do I apply a WMI filter via the GPMC?
September 2, 2007
A. The GPMC makes it easy to apply a WMI filter to control the application of a GPO based on WMI results. For example, you might want to install an application only if the target computer has at least 1GB of free disk space. To accomplish this, you create a WMI filter and apply it to the GPO. Remember, the system applies the filter to the GPO, not the linkage of a GPO; so, when a filter is applied, it affects anywhere in the enterprise the GPO is linked.
To create a filter, select the WMI Filters container for the domain in the GPMC, right-click WMI Filters, and select New. Enter a name and a description for the WMI Filter. Click Add to add a WMI Query Language (WQL) to the filter. By default, the creation process selects the root CIMv2 folder, in which most WMI computer-related settings reside.
Enter a query. For example, to check for disk space, you would query Win32_LogicalDisk and the FreeSpace and Caption attributes, as follows:
select * from Win32_LogicalDisk where FreeSpace>1073741824 and Caption = 'c:'".
Click OK, and when complete, click Save.
The WMI Filter now exists and can be assigned to a GPO. Select the GPO you want to apply the WMI Filter to from the Group Policy Objects container, and select the Scope tab. In the WMI Filtering section, select WMI Filter from the display and click Yes to confirm the setting of the WMI for the GPO. Once set, the GPO will be applied only if the WMI filter returns true.
You can now use the Gpresult or the GPMC Group Policy Results tool to check why a GPO with a filter was or wasn’t applied.
About the Author
You May Also Like