Hey, here is Martin again.
One of the most viewed article on this blog is about this Topic. I will give a small update for the new System Center 2012 Configuration Manager R2 release. Thus this release now supports to run most of the cmdlets for SCCM also in x64 mode (exceptions see: http://technet.microsoft.com/library/dn236347.aspx).
And with this, the script needs no changes, except the remove of the check for the x86 architecture.
I just added a check that the collection has to exist, before the check is done, that the Direct Membership rule exist for the specific device in the specific collection.
Please read my last blog post about this Topic carefully (https://blog.hosebei.ch/2013/05/20/sccm-2012-sp1-remove-client-from-collection-after-osd/), as a small reminder:
-Trust the Module that has to be imported
-The server that runs the rule has to be added with permissions
The comments can be also very useful for you when you got Problems with the implementation!
Here you can find my updated script:
For any suggestions what I could make better, I’m happy to hear from you something in the comments 🙂