I wrote a script long ago which actually started in a Technet froum thread that removes the computer from the OSD collection after a successful OS deployment using a status filter rule. I have used it many times since. https://ccmexec.com/2012/07/remove-from-collection-and-clear-pxe-flag-vbscript-using-status-filter-rule/
Now I thought that the time had come to re-write it in Powershell instead, but I found that this had already been done.. It can be found here:
http://servertechs.info/remove-client-from-collection-after-successful-sccm-task-sequence-powershell/
So instead of re-writing the script I will post the link here instead.
Do not underestimate the effect of this process in larger environments.
What I found out when automating our worldwide os deployment was that if you want collection handling to scale (~ 100 osd preparations/finished installations a day, worldwide – so ~200 collection modifications a day) the collection evaluator (at least in SCCM 2007 SP2 R3) will not be fast enough to correctly handle all the collection modification requests.
I came up with using a webservice that registers the job to remove the client from the collection, pools them and on a defined timer uses DeleteMembershipRules from SMS_Collection instead of DeleteMembershipRule.
However, we’re using queries with the devices MAC instead of direct memberships (due to several reasons) and I haven’t looked at what exactly the SCCM 2012 SP1 cmdlets do in the background.
From my experience however, I guess it still just calls DeleteMembershipRule.