Share via


Create the WMI Filters

Applies To: Windows Server 2008

Use this procedure to create the WMI filters that are used to restrict the application of a GPO to the computers in the membership group that are running the version of Windows for which the GPO is intended.

Membership in Domain Admins is the minimum required to complete this procedure.

To create the WMI filters

  1. Log on to your domain controller as a member of the Domain Admins group.

  2. Click Start, and then click Server Manager.

    The Server Manager console opens.

  3. In the navigation pane, expand Features, expand Group Policy Management, expand Forest: your forest name, expand Domains, expand your domain, and then click WMI Filters.

  4. Click Action, and then click New.

  5. In the New WMI Filter dialog box, in Name, type the name of the filter. Use a name that indicates the target group (for example, Windows Server 2008).

  6. In Description, type the purpose of the filter.

  7. Click Add.

    The WMI Query dialog box appears.

  8. In Query, type the WMI Query Language (WQL) string that returns TRUE when applied to the correct version of Windows. For example, for Windows Server 2008 type:

    select * from Win32_OperatingSystem where Version like "6.0%" and ProductType = "3"
    

    Both Windows Server 2008 and Windows Vista return version numbers that begin with 6.0. To differentiate between the client and server versions, include the clause to check the ProductType field. This value returns 1 for client versions of Windows such as Windows Vista, 2 for server versions of Windows operating as domain controllers, and 3 for server versions of Windows that are not operating as domain controllers.

  9. Repeat step 8 for each of the other versions of Windows. The following table shows sample query statements for each version.

    WMI Filter Name WQL Query Statement

    Windows Vista

    select * from Win32_OperatingSystem where Version like "6.0%" and ProductType = "1"

    Windows Server 2003

    select * from Win32_OperatingSystem where Version like "5.2%" and ProductType = "3"

    Windows XP

    select * from Win32_OperatingSystem where (Version like "5.1%" or Version like "5.2%") and ProductType = "1"

    Windows 2000

    select * from Win32_OperatingSystem where Version like "5.0%"

Note

The filter for Windows 2000 is used to prevent computers that are running later versions of Windows from applying the GPO. You cannot use a WMI filter to apply a GPO to computers that are running Windows 2000 because that version of the operating system does not support WMI filters.

You can also create combination filters when required by your design. The following table shows query statements for common operating system combinations.


<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<thead>
<tr class="header">
<th>WMI Filter Name</th>
<th>WQL Query Statement</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><p>Windows Vista and Windows Server 2008</p></td>
<td><p><code>select * from Win32_OperatingSystem where Version like &quot;6.0%&quot; and ProductType&lt;&gt;&quot;2&quot;</code></p></td>
</tr>
<tr class="even">
<td><p>Windows Server 2003 and Windows Server 2008</p></td>
<td><p><code>select * from Win32_OperatingSystem where (Version like &quot;5.2%&quot; or Version like &quot;6.0%&quot;) and ProductType=&quot;3&quot;</code></p></td>
</tr>
<tr class="odd">
<td><p>Windows 2000, XP and 2003</p></td>
<td><p><code>select * from Win32_OperatingSystem where Version like &quot;5.%&quot; and ProductType&lt;&gt;&quot;2&quot;</code></p></td>
</tr>
</tbody>
</table>