Figuring out the collectionid for Linked collections in SMS 2003.

September 12, 2007 at 9:00 am in ConfigMgr 2007, SCCM 2007, SMS, Sms 2003 by The WMI guy

This week someone in the newsgroups asked a question about how to create a collection excluding members from another collection. The answer to that question is based on the knowledge that every collection you make in Sms or Configmgr 2007 aka Sccm creates its own wmi class. The class will be named sms_cm_res_coll_collectionid.

So the answer to the question becomes something like

1) Create your collection

2) Add a query based membership rule to your collection

3) Edit the query statement of the collection

4) On the criteria tab add a criteria

5) For the attribute class select System Resource, and use Resource Id for the attribute

6) For the criteria type use subselect

7) For the operator select “Not In”

8) In the query box type select resourceid from sms_cm_res_coll_collectionid.

EDIT: Janne Mansnerus  kindly pointed out that this didn’t work, the original post specified the query as sms_cm_ress_coll_collectionid. In reality the class is called sms_cm_res_coll_collectionid. So res with single s instead or ress.


This all works fine, with one difficulty to overcome, you need to figure out the collection id, and that is not as easy as it could be, especially if you need the collectionid of a linked collection. That’s why I have created a prompted query to easily find the collectionid based on the collection name. Here is how you create the query.

1) Go to queries

2) Right-click and select new query

3) Make sure you specify <unspecified> in the Object type dialog.

4) Press the Edit Query button

5) Paste the following query in the Query statement box that opens up:

select collectionid, name from sms_collection where name like ##PRM:SMS_collection.Name##

Note: You can use the _ and % wildcard signs when you input the collection name.

Note2: This query is no longer necessary once you migrate to SCCM 2007, the new admin UI in Configmgr 2007 has the collectionid written down on the properties page of every collection. The flexible approach by using the sms_cm_ress_coll_collectionid for building collections is still very valid though. This approach is usually used whenever someone is looking for the reverse option of “collection limiting” collections.

Enjoy, and as usual you can find me in the Microsoft.public.sms.* newsgroups!

Everyone is an expert at something”

Kim Oppalfens – Sms Expert for lack of any other expertise
Windows Server System MVP – SMS

Technorati Tags: , ,


Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInPin on Pinterest