Wednesday, December 13, 2006

Query: Build collection to exclude members of another collection

This has proven to be quite useful. Here's how to create a query-based collection that will exclude members of another collection:

1. Create a collection that will contain all clients to be excluded from another collection (we'll call it 'ExclusionsCollection' for this example.)

2. Once you have that, go into the Collections table in the SMS SQL database and find the row that contains 'ExclusionsCollection'. Note the cooresponding 'ResultTableName'.

3. In the collection that you want to exclude the members of 'ExclusionsList' from, copy and paste the following query:

select SMS_R_System.ResourceID,SMS_R_System.ResourceType,
SMS_R_System.Name,SMS_R_System.SMSUniqueIdentifier,
SMS_R_System.ResourceDomainORWorkgroup,SMS_R_System.Client
from SMS_R_System where Client = 1 and ClientType = 1 and
ResourceId not in (select ResourceID from SMS_CM_RES_COLL_XXXxxxxx)

4. Replace the item above in red with your ResultTableName.

So, machine will be manually entered into 'ExclusionsCollection' will be excluded from the collection with the above query. So say that you wanted to deploy a package to all XP machines except for a specific few, you'd create a collection and limit it to the 'All XP Machines' collection, and then add the above query.

12 Comments:

Anonymous Anonymous said...

Maaaan did this save my day. This is very useful. I wish the "limit to collection" could be reversed to give this option in reporting.

3:32 PM  
Anonymous Anonymous said...

Hello, great site, I found a lot of useful information here, thanks a lot for Your work!
With the best regards!
Jimmy

2:55 PM  
Blogger blogkatt said...

info provided is worth.
I would like to know how an individual computer can be added to a collection.
My scenario is like this . I have to add five computers and then push packages out of the 5000 computers.

9:29 AM  
Anonymous Anonymous said...

Hello!I enjoyed looking around Your web-site!Keep up this great resourse!With the best regards!
Frank

10:02 AM  
Anonymous Anonymous said...

Your article is very informative and helped me further.

Thanks, David

5:05 PM  
Anonymous Anonymous said...

Excellent info. Too bad the comment bots are hard at work here. I have also bookmarked your site and look forward to future posts.

4:34 PM  
Anonymous Anonymous said...

Nice on Mr Kaiser. The query I used to find the ResultTableName is

select resulttablename from collections where collectionname = 'exclusioncollection'

Which returns something like _RES_COLL_ABC12345

(where "ABC" is your site code)

Then the last line of the collection membership query for the collection you want to advertise to becomes

ResourceId not in (select ResourceID from SMS_CM_RES_COLL_ABC12345)


Thanks
- Adam

12:11 AM  
Anonymous Anonymous said...

Thanks, I have been very helpful.

3:42 AM  
Anonymous Anonymous said...

extremely helpful!! You Rock!

3:05 PM  
Blogger Ed Gonzalez said...

Thanks a lot, this had me scratching my head before I found this site. Bookmarked forever so I can reap the benefits of your knowledge and experience in the future!

~Ed

12:21 PM  
Anonymous Viagra Online said...

Hi, I just wanted to mention that you r blog has become a daily must-check for me, it's really interesting and the minutes fly aways when I'm here. Keep it up.

4:43 PM  
Blogger nidhi kumari said...

holi shayari images 2017

www.shayariimages2017.com

9:36 AM  

Post a Comment

<< Home