I wrote a post a long while ago which started as question in on Technet Forum on how to remove a computer from a collection using a status filter rule once the OS deployment Task sequence is successful, I posted the script here: https://ccmexec.com/2010/03/remove-a-computer-from-a-collections-when-osd-task-sequence-is-completed/.
I still use it in almost all of my implementations of Configuration Manager. In one customer scenario I had to clear the PXE flag as well so I added that to the script so now you can select if you want the script to clear the PXE flag as well on the client when it is removed from the OS deployment collection.
The script works fine both in Configuration Manager 2007 and Configuration Manager 2012.
Why using a Status Filter Rule instead of a script in the TS run from the client side? Well you don’t have to open any firewall ports in the server for WMI e.t.c. You could also implement Webservices which do the same task for you, i like the simpleness in the status filter rule though.
The script can be downloaded here: Vbscript remove from Collection
To implement it:
1. Download the script and save it as “remove.vbs” in for instance E:\sccmtools or another folder on the Primary Site server.
2. Edit the following line with the collection/collections you want the computer removed from
sCollectionIDs = “00100053:0010004A:00100069″
You can now also configure if you want the script to clear the pxeflag by changing this value.
ClearLastPxe = “1”
You can also have the script to write to the eventlog on the Primary Site Server which Computername will be removed from which collections if you need to troubleshoot.
sEventlog = “1”
When that is done, save the file
3. Create a status filer rule, this screenshots are from Configuration Manager 2012 not that much differs.
4. Create a new status filter rule under Site Configuration\Sites choosing Status Filter rules.
5. Select Create
6. Configure it to use the following settings:
Name: Remove From Collection
Component : Task Sequence Manager
Message Id: 11171
Note: You have to type in “Task Sequence Manager” it is not available in the drop-down list as it is not a server component.
7. Run a Program: C:\windows\System32\cscript.exe e:\sccmtools\remove.vbs %msgsys
8. The next screen confirms that you are finished.
Now you have successfully implemented the Status Filter rule and can start testing.