How to perform an action directly after the task sequence is finished with ConfigMgr 2012

Last week I already did a post about a new task sequence variable and this week my post will be about another new task sequence variable. This one will probably be used a little less, but can be very useful in some specific situations. Think about situations where an action needs to be performed directly after the task sequence is finished, without impacting the status of the task sequence. In this post I will use a situation where I want the machine to shutdown at the end of the task sequence, as an example.


TSEdiSMSTSPosActJust like last week, the configuration is actually very easy and it’s just more about knowing that the task sequence variable exists. This is another new task sequence variable in ConfigMgr 2012 SP1, which is currently still in BETA, named SMSTSPostAction. This task sequence variable can be used to configure a post action for a task sequence. To configure this, follow the next steps:

  • Open a task sequence in the Task Sequence Editor.
  • Add a Set Task Sequence Variable –step to the task sequence.
  • Fill in as Task Sequence Variable SMSTSPostAction and, in this example, as Value cmd /c shutdown /s /t 0 /f.
  • Close the Task Sequence Editor.


Normally adding a shutdown action to a task sequence would cause the task sequence to fail, but now the task sequence will first end successfully and then it will perform the shutdown. A look at the deployment status will show this result. And of course I can show a screenshot of that or of a turned off machine, but I think the SMSTS.log will show some more useful information. As the SMSTS.log will also log the post action.SMSTSLogAct_1SMSTSLogAct_2


Keep in mind that the SMSTS.log will register the action, but does not register a success or failure of the action.


6 thoughts on “How to perform an action directly after the task sequence is finished with ConfigMgr 2012

  1. Hi peter,

    did you test this yourself? I’m trying to implement this in a task sequence (application type) and it does nothing. I have an empty task sequence (for speed of debugging) which only contains the step as you described and a second debugging step to dump all task sequence variables to a logfile. The logfile contains
    SMSTSPostaction = cmd /c shutdown /r /t 0 /f
    but still nothing is executed at the end of the task sequence. The TS is exiting with status Installed, so the error is not in the TS.

    Do you have any suggestion? My SCCM 2012 R2 environment is version 5.00.7958.100. Which should support this variable isn’t it?
    Thanks in advance…

  2. Hi Mike,

    Yes, I’ve tested this myself and yes, it should still be available in ConfigMgr 2012 R2.

    When it’s working properly, the smsts.log should show information about an End program that’s being set.


  3. Hej Peter,
    i tried run powershell commando in Task Sequence via variable SMSTSPostAction:

    powershell -Command {Disable-ComputerRestore -Drive “C:\”}

    But unfortunatly there is no action on the clients :/

    My environment version is 5.00.7958.1000 SCCM 2012 R2

    Have you got any suggestions?

    Thanks in advance!

  4. Problem is solved 🙂
    i used:
    powershell -Command “”

    in instead for :
    powershell -Command {Disable-ComputerRestore -Drive “C:\”}

Leave a Comment