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.
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:
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.
Hello, great site, I found a lot of useful information here, thanks a lot for Your work!
With the best regards!
Jimmy
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.
Hello!I enjoyed looking around Your web-site!Keep up this great resourse!With the best regards!
Frank
Your article is very informative and helped me further.
Thanks, David
Excellent info. Too bad the comment bots are hard at work here. I have also bookmarked your site and look forward to future posts.
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
Thanks, I have been very helpful.
extremely helpful!! You Rock!
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
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.
holi shayari images 2017
www.shayariimages2017.com
Post a Comment
<< Home