Collections and Queries

SMS collects and uses a large amount of data to manage sites. That data is stored at each primary site's database. Different SMS administrative tasks require different sets of data from the SMS site database. Queries are run against the site's database and retrieve specific data according to the criteria of the query. SMS provides many predefined queries. If required, you can create additional queries. A query can retrieve information about a specific client or summary information about multiple clients.

SMS manages resources, such as users, user groups, and client computers. Each resource is associated with a unique set of attributes. Data about resources and their attributes is stored in the site's database. Collections are logical groups of SMS resources that satisfy criteria defined by the administrator. Collections are designed to gather resources into useful groups that you can manage within your site hierarchy.

You can create a collection by defining rules that add individual resources to the collection. More often, you define rules that are based on a query for an attribute that resources have. This creates a collection of resources with one or more common attributes. The rules that you use to define the collection's member list are referred to as the collection's membership rules.

Query-based collections are dynamic objects. If a resource no longer meets the collection's query, it is automatically removed from the collection. And if a resource that originally did not meet the collection's query has changed in a way that it now meets the collection's query, it is automatically added to the collection. This behavior greatly reduces and simplifies the administrative work of managing the clients.

SMS 2003 includes several predefined collections that query for Windows®-based operating systems. An important predefined collection is the All Systems collection, which is defined to include all resources in the site. This means that every new resource in the site automatically becomes a member of the All Systems collection. It is recommended that you do not modify the definition of this collection.

Collections and Queries Throughout the Site Hierarchy

When you create a collection, SMS evaluates the membership rules to determine which resources should become members of that collection. If the collection is based on a query, SMS runs the query against the site database. In an SMS hierarchy, primary site databases do not contain data about resources from upper level sites. The current site's collections cannot contain resources from upper level sites.

When you create collections at a parent site, SMS propagates them to lower level primary and secondary sites. You can modify or delete collections only at the site that they were created in. At child sites, you cannot modify collections that were propagated from an upper level site. Queries are not propagated to lower level sites.

When SMS propagates a collection, primary child sites receive only the definition of the collection. This includes the collection's general data and its membership rules, but it does not include the actual list of clients that are members of that collection. Each primary child site evaluates the propagated collection's membership rules. If the collection is based on a query, the query runs against the current SMS site database. This process generates the member list for the propagated collection, which has two advantages:

  • Less information is transmitted over the network.

  • It is easier for SMS to keep the membership list of the collection up to date at child primary sites.

When SMS propagates a collection, secondary child sites receive only the list of clients that are members of the collection. They do not receive the collection definition. Because secondary sites do not maintain their own database, the secondary site's parent site evaluates the collection's membership rules for the secondary site and generates the membership list. The membership list includes resources from only the secondary site. When a collection is re-evaluated at the parent site, the parent site sends updated membership lists to its secondary sites.

Occasionally, you might want to share a collection or a query with administrators of SMS sites to which the collection or the query is not automatically propagated. To accomplish this, you can use the Export Object Wizard to export collection and query object definitions from your SMS site database to a Managed Object Format (MOF) file.


  • MOF is a standard text file that contains computer management information in a standard format that can be loaded into the SMS site database.

You can use the Import Object Wizard to import these MOF files back into the site's database or into another site's database. However, when running a query that was imported from another site, it runs against the current site's database.

Benefits of Collections and Queries

Some SMS features can operate on clients only if they are members of a collection. For example, to distribute software to clients in the hierarchy, you must first create a collection that includes all the clients that need to receive the distributed software. For other features, such as inventory, the resources must be members of a collection to view their inventory data in Resource Explorer. Resource Explorer is an application that you can launch from the SMS Administrator console to view inventory data for resources in the hierarchy.

Often, the collection's membership rules are based on a query. You create a query with the criteria that the desired set of resources will satisfy, such as all clients that are running Microsoft Windows XP. Then you define a collection that is based on the query. The query searches the SMS site database. All the resources in the site's database that satisfy that query become members of the collection. By using the Windows XP query, all clients running Windows XP become members of that collection.

SMS provides a number of predefined queries that you can use. You can modify a predefined query or create new queries. By running queries, you can retrieve the list of all clients running a specific operating system or all clients with an almost full hard disk drive. This information helps you anticipate software and hardware upgrades and can help you make other administrative decisions.

With SMS 2003, you can leverage Active Directory® domains, organizational units, groups, and sites when defining collections. If Active Directory is deployed with logical organization units, sites, and security groups, and if a large number of computers are running Microsoft Windows 2000 or later, then you can benefit from this capability by creating collections based on Active Directory containers. These collections can be used for software distribution.

For More Information

Did you find this information useful? Please send your suggestions and comments about the documentation to