Group Policy and WMI filtering for OS

Many times, we have to apply some GPO only to particular OS, domain controllers or servers. As we know, this is possible with WMI filtering, but it is very difficult to found all parameters to determinate the operating system in one place. This is why I want to write this post.

When you want to use a WMI filter for query OS, you have to use WMI\CimV2 namespace and there are listed some values that you must know:

Operating system version – we can determinate the version of OS with the variable Version:

Windows Server 2012 Version like “6.2%”

Windows Server 2008 R2 Version like “6.1%”

Windows Server 2008 Version like “6.0%”

Windows Server 2003 Version like “5.2%”

Windows 8 Version like “6.2%”

Windows 7 Version like “6.1%”

Windows Vista Version like “6.0%”

Windows XP (Version like “5.1%” or Version like “5.2%”)

As we can see very quickly, some OS have the same number of OS Version, so we have to adopt the second variable ProductType to have a selection:

Client operating systems ProductType=”1″

Domain controllers ProductType=”2″

Servers that are not domain controllers ProductType=”3″

Now, with the combination of those two variables, we can find only the operating system that we need. However, is it a 32 or 64 bit system? Of course, we can sort also this characteristic with another variable – AddressWidth:

32bit systems AddressWidth = “32”

64bit systems AddressWidth = “64”

At the end, to be more clear, I want to write some examples:

All domain controllers in domain:

select * from Win32_OperatingSystem where ProductType = “3”

All 64 bit Windows 8 OS:

select * from Win32_OperatingSystem where Version like “6.2%” and ProductType = “1” and AddressWidth = “64”

All Windows 2012 servers that are non DC’s:

select * from Win32_OperatingSystem where Version like “6.2%” and ProductType = “3”

Of course, we can filter on many more variables than explained. There are many parameters, which are explained on TechNet and in White papers. For example, we can apply policy (e.g. to install some software) only to computers that have more than 1GB of space on HD:

Select * from Win32_LogicalDisk where FreeSpace > 1073741824 (space is in kb).

Recommended Reading

Comments Icon2 comments found on “Group Policy and WMI filtering for OS

  1. I had problems to find your website in google. You need more hi authority contextual backlinks in order to rank.
    It is very expensive to buy backlinks it is better to have own private blog
    network, you can build your PBN from hi page authority expired tumblr blogs.
    How to get expired tumblr? Search in google:
    Expired Tumblrs Paradise

    1. Oh, I am sorry for that.
      I will talk to my web admin and we will solve that problem.
      Thank you for a comment.

Discuss

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.