Today I had to re-run a task sequence which had failed the first time. I figured that it could probably be done with PowerShell. After reading Steve Rauchi’s blog post on how to remove the scheduler history object, I started out trying to accomplish the same thing with PowerShell.

In the Configuration Manager 2012 console, we need to locate what Package ID the task sequence has. The Package ID can be found under Software Library – Operating Systems – Task Sequences in the Package IDcolumn for the task sequence in question. In this case the Package ID was C01000D0. We will locate the instance in WMI by searching for the ScheduleID property.

Let start off with the code to locate the instance in WMI containing the Package ID. Launch PowerShell with administrative rights, and type:

Get-WmiObject -Namespace "root\ccm\scheduler" -Class ccm_scheduler_history | where {$_.ScheduleID -like "*C01000D0*"} | ft ScheduleID

This should give the following results:


Now that we have the instance, we need to delete it. Modify the previous command so it looks like:

Get-WmiObject -Namespace "root\ccm\scheduler" -Class ccm_scheduler_history | where {$_.ScheduleID -like "*C01000D0*"} | Remove-WmiObject

The instance should now be deleted. Run the first command again, to verify the ouput is empty. Once that is done, we need to restart the CcmExec service. Run the following command:

Get-Service | where {$_.Name -eq "CCMExec"} | Restart-Service

Once the service has restarted, the task sequence should kick off again automatically.


  • Jim Webb
    Posted at 21:44 May 27, 2014
    Jim Webb

    Awesome tip! Very helpful! Thanks!

    • Nickolaj
      Posted at 17:53 May 29, 2014

      Hi Jim,

      Thanks for the kind words! Have you checked out the prerequisites script that I just released? It’s definitely worth checking out.


  • Alex
    Posted at 10:31 March 19, 2015

    That’s great. Thanks

  • Dennis de Haan
    Posted at 12:52 November 16, 2015
    Dennis de Haan

    I just can’t get it to work 🙁 We’re running SCCM 2012 R2 on a Windows 8.1 workstation.

    Removing the Task sequence ID works, but when i restart the service nothing happens and after a few seconds the Task Sequence ID is available again.

    The Re-run Task Sequence Tool has the same effect 🙁 Any ideas what goes wrong?

    • Jay Gingras
      Posted at 19:46 December 12, 2016
      Jay Gingras

      I’m having the same problem, just comes back right after. Even tried pulling machine from collection, after it was gone from Software centre ran script, all was good, re-add machine to collection, once policy hit machine, it was once again “Installed” and in the WMI as well…

  • Geppo
    Posted at 20:37 May 29, 2018

    Tried to use the same way for Packages and Programs. It should work, but after SMS agent host service restart, I’ve got “A duplicate execution request is found for program …” in execmgr.log.
    It would be great if you have the key to solve it, Nikolaj :))

  • Gary Knigge
    Posted at 18:53 January 17, 2019
    Gary Knigge

    I wish there were a way to run a task sequence immediately, even for the first time. When I add a computer to a collection with a TS deployment it can take a very long time before the TS is available in the software center. This is true even when I download machine policy manually in the CM Control Panel.

  • Leave a Reply to Nickolaj
    Cancel Reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.