Monday, November 23, 2009

SCCM: Forcing a Task Sequence to Rerun

There are well known methods to force an advertisement to rerun – including several add-on tools available for the SMS or SCCM console.  To date, however, there are not equivalent methods to force a task sequence to rerun.  Part of this may be because task sequences are typically thought of as focused on Operating System Deployment (OSD) and rerunning these types of distributions are not as common as rerunning advertisements.

While task sequences are the best solution out there for OS Deployments they are much more flexible than just that – including distributing software in very complex scenarios including support of dynamic decisions during execution, handling reboots, enabling specific sequencing of application deployment, etc.  With this kind of power many organizations are using task sequences for software deployment and the ability to force a sequence to rerun on a selective basis and without having to manually logon to individual clients is crucial.  The process to make this happen is very easy.
First, identify your task sequence by ID.  My test sequence is CEN00027.

Note that in my lab this sequence has already run in the past.
The advertisement for the sequence is set with a mandatory execution time – which resulted in the first run.  No other mandatory times have been added.  Further, the advertisement is set to allow rerunning.  If you had an advertisement set to not rerun you should be able to force it to rerun but this would likel require additional WMI and registry edits.  I haven’t tested that specific scenario.
From here, open WMI on the client system of interest and connect to the root\ccm\scheduler namespace.
Click ‘Enum Classes’, select Recursive and then scroll to the bottom and double click on CCM_Scheduler_History() and then click instances.
In the list that shows up, find the entry that corresponds to your task sequence ID and delete it.
With the deletion made, restart the SMS Agent Host service (CCMExec) on the target client.
In a few minutes, the program balloon will pop up indicating the sequence is about to run again.
The process described is manual but could be automated if desired.