Tuesday, November 1, 2011

Create new Windows collections based on Query rules

Collections in ConfigMgr can be used for dynamic view. This will happen when a Query rule is used, based on Operating Systems or Active Directory containers (for example). There are a few blogs which describes this functionality already:

How to create a query based on Direct membership is described here:

How to configure ConfigMgr collections to Active Directory containers is described here:

In this blog I will describe how to create a new collection with Query rule.

First create a new collection in ConfigMgr and choose Membership rules based on Query rule. Click the [yellow database icon] and choose the query explained below. Choose "Dynamically add new resources" when using ConfigMgr R3 to automatically add new devices.

In this case I'm using a Resource class based on System Resource and  "Edit Query Statement" for creating a new Query rule.

Select the Criteria tab and the [yellow star icon] for that. Click "Select" afterwards.

In this case I'm using a Attribute class based on System Resource and a  Attribute based on "Operating System Name and Version".

When choose OK in the screen before (Select Attribute) the above screen will be displayed. Choose [Operator: Is Like] and Value based on Operating System variable here.

When choose OK in the screen before (Criterion Properties) the above screen will be displayed. Click OK afterwards.

The new collection with Query rule is ready now. All Windows 7 systems (in my case) will be automatically added in this new collection.

For new Windows releases use the following queries:
  • Windows Vista: Value = %Workstation 6.0%
  • Windows 7: Value = %Workstation 6.1%
  • Windows 8: Value = %Workstation 6.2%
  • Windows Server 2008: Value = %Server 6.0%
  • Windows Server 2008 R2: Value = %Server 6.1%
  • Windows Server 8: Value = %Server 6.2%

That way it's possible to create new collections with support on new Operating Systems. I will add support for new Operating Systems later when available.


  1. Collections use WQL, not SQL - so the title of the article is wrong.

  2. You're right! I changed that in the blogpost already, but not in the title.

    Thanks for mentioning!

  3. What about Windows 7 SP1 machines

    1. You can still using %Workstation 6.1% for that!

    2. What if we want only Windows 7 SP1 workstations but we also have non-SP1 workstations on the network? The reasonI ask is because the recent patch issued by Microsoft to protect against the recent ransomware attacks requires Windows 7 SP1 or higher.

  4. Where can i get a query to view all the different OS versions of a specific collection?