It is a common scenario that the Windows deployment collections fill up with clients, who has already completed the OSD. If you use mandatory deployments, this is not an issue, but if you are using available deployments, you might have users who accidently reinstall their computers.
There is nothing built into Configuration Manager to do this, but luckily it can be done with a PowerShell script and a status filter rule.
There are a couple of prerequisites
- The ConfigMgr PowerShell module must be trusted.
- The ConfigMgr server needs permissions in SCCM and DCOM.
- This version of the PowerShell script requires SCCM 2012 R2.
To trust the PowerShell module, run PowerShell from the Configuration Manager console. Answer “A” when it asks, “Do you want to run software from this untrusted publisher?”
Your ConfigMgr server needs “full administrator” rights in SCCM. To do this, go to \Administration\Overview\Security\Administrative Users in the SCCM console and “add user or group”. Find your server under browse and add it to “Full Administrator”.
To grant your ConfigMgr server the appropriate rights in DCOM, start Component Services and expand Computers and rightclick ‘My Computer’. Go to the tab “COM Security” and click “Edit Default” under “Access Permissions”. Ensure the System has ‘Allow’ in Remote Access.
Now that the prerequisites are in place, we can move on to the actual function. This consists of a PowerShell script that does the actual legwork and a status filter rule that decides when to run the script.
The PowerShell script
All you have to edit in this script are the collection ID’s.
Status Filter Rule
To create the rule that runs the script, when a client has successfully finished OSD, do the following. In the Configuration Manager console, navigate to \Administration\Overview\Site Configuration\Sites, select your site and click status filter rules, either by right clicking or by selecting it on the ribbon.
Create a new rule as follows:
- Component: Task Sequence Manager (this can’t be selected from the drop down menu, you need to write it).
- Message ID: 11171 (the task sequence completed successfully message in SCCM)
- Check “report to the event log” if you want this.
- Check “replicate to the parent site”
- Check “run a program” in put this in the program box:
Click next and finish – and your new status filter rule is in place and ready for testing.