A Task Sequence deployment in SCCM can be set to Required to start the deployment without any user interaction (F12 etc.). Also the rerun behavior can be set to Always rerun program to keep running the deployment until the object (Resource) is removed from the collection.
These two options make it easy to (re)start a new deployment from within SCCM by adding the Resource to the Collection.

But… the option Always rerun program will rerun the Task Sequence until the resource is removed from the Collection. Removing the Resource after a Task Sequence is finished is not a default option within SCCM, but using the following guide and script it is possible. The script will also write an output to a log file so by checking the file or check if the Resource is still member of the Collection it is possible to check if the Task Sequence is finished.


Download the script here

Extract the zip file to a (network) location. image
Open the Remove.VBS file with a text editor image
Start the SCCM console and find the Collection ID of the Collection where the Resource must be deleted from when the deployment is finished imageimage
Go back to the VBS script in the editor and add the Collection ID’s in the sCollectionIDs section image
Change the location of the log files image
Optional: Change the filename of the log file image
Save the VBS file
Start the SCCM console
Click on Administration image
Click on Sites image
Click on Status Filter Rules image
Click on Create image
Enter a name, for example: Remove computer from OSD collectionsEnter the Message ID 111171

Click Next

Select Report to Event Log

Select Run a Program
Enter C:\windows\System32\cscript.exe C:\remove.vbs %msgsys

(Change the script location if necessary, a network location is also possible as long as SCCM can access the file)Click on Next and finish the Wizard

The result looks like this: imageimage

Add a Resource to the Collection and start the Task Sequence, check if the Resource is remove when the Task Sequence is finished. It is also possible to check the log file to see if the script has succesfully ran.


Comments are closed