A warning about direct memberships in collections

Today’s blog post again comes from a fellow PFE and I can’t take any credit.  However, I thought it was a worthwhile topic and I wanted to make sure the knowledge and information is out there for other folks.

When you create a collection and decide to populate it you have two options, direct membership and query based.  Many folks use direct membership because it is very easy to do compared to a query.  Pick a machine, and it is in your collection.  This works fine if you are setting up a quick package test or something similar but there is a pitfall most folks are not thinking about.  When you do this you may pick a machine/user based on its name, but under the covers SCCM is actually assigning the resource based on an ID number.

Where this can come back to haunt folks is if a machine should change its ID number.  To the SCCM administrator the machine still shows in the admin console, but would no longer be a member of any collections where it was directly assigned.  A machine can change its ID number for various reasons, such as an OS upgrade (hopefully via the OSD feature), because it is accidently deleted from SCCM and then repopulates from a new DDR, or if maintenance tasks are set to aggressively and delete the current record.

The solution here is slightly more work in the short term, but can save you some work in the long run.  When you create that collection membership make it query based and in that query you can specify to return all machines/users with a specific name.  Now no matter what happens to the machine and it’s ID in SCCM it will continue to be a member of the collection as long as it keeps the same name.

One more catch, this time in relation to the solution I mentioned.  I have heard (but not witnessed myself) that collections with a large amount of queries can perform poorly.  I would suggest that rather than making one query for each machine you want you instead make a single query that is a “list of values” instead of the more standard “simple value” and then just add all your machines to that one query.