Menu
CCMEXEC.COM – Enterprise Mobility
  • Home
  • General
  • Configuration Manager
  • Windows 10
  • Intune
  • GitHub
  • Windows 11
  • About the author
CCMEXEC.COM – Enterprise Mobility

New Task Sequence Variable PostAction in ConfigMgr 2012 SP1

Posted on February 28, 2013March 6, 2013 by Jörgen Nilsson

There are so many new cool features in Configuration Manager 2012 Service Pack 1. I have had the intention of doing a blog post series on news in Configuration Manager Service Pack 1 for many months now, but now I will finally start with it. I will not write about the big new features like MAC Support, Linux Support, Cloud DP, Pull DP, I will try to focus on the smaller but very useful new features.
There was a question asked on the forum on how to add a “true” restart in the end of a task sequence, which normally would have broken the task sequence, in ConfigMgr 2012 SP1 there is a new Task Sequence variable called SMSTSPostaction.
If you put a command in that variable it will be executed after the Task Sequence completes.
Think of the possibilities here, you could add your own custom script waiting for the Configuration Manager Client to be fully operational then trigger a script to install all applications available to the computer and display a message to the user that the computer is still not ready.
I will keep this simple and use the Shutdown.exe command in the example to force a “true” restart after the Task Sequence is complete. It can of course be used in custom task sequences as well.

It is so simple, create a  Task Sequence variable name it SMSTSPostaction and enter the command to execute, in this case “Shutdown /r ” which will restart the computer after 30 seconds.

postaction

Truly a small but great new feature.

11 thoughts on “New Task Sequence Variable PostAction in ConfigMgr 2012 SP1”

  1. Mathew says:
    March 4, 2013 at 10:15 am

    Hi Jörgen

    place this at the very last step of a TS?

    Reply
    1. Jörgen Nilsson says:
      March 4, 2013 at 11:39 am

      Hi,
      It doesn’t matter where it is placed in the Task Sequence as long as the variable is set it will run anyway.

      /Jörgen

      Reply
  2. Pingback: Field Note Friday #001 - Martyn Coupland
  3. Jason Oliphant says:
    May 22, 2014 at 4:18 pm

    There can only be one SMSTSPostAction steps correct? I was trying to add 4 of them and it only picks up the last one.

    Reply
    1. Jörgen Nilsson says:
      June 13, 2014 at 12:02 pm

      Hi,
      Yes you can only have one command but separating the command lines with $ in the Task Sequence variable will work just fine.
      /Jörgen

      Reply
  4. Martin says:
    June 19, 2014 at 7:53 pm

    Hi

    I tried this:

    gpupdate /force$REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\CCM\CcmExec /v test /t REG_SZ /d test /f$shutdown /r

    it fails.. If I remove the 2nd & 3rd part after/incl. $ .. then it works..

    So I’m not sure the $ works..?

    Reply
  5. Kenneth Sundby says:
    September 20, 2014 at 9:18 am

    I think maybe he meant & or &&.

    http://technet.microsoft.com/en-us/library/bb490954.aspx

    Reply
  6. Mats Binkowsky says:
    January 20, 2016 at 9:54 am

    I managed to Uninstall ConfigMgr 2012 Sp1 client agent in TS with variable “SMSTSPostaction”.

    Read my tweet:

    https://twitter.com/IT_Binkan/status/689697201065426945

    Reply
  7. Joris van der Struijk says:
    September 2, 2016 at 2:29 pm

    I am trying to implement a solution where our freshly images machines are fully operational when imaging process is ready. For me this also means that the SCCM client is operational and has received it’s policies.
    In your blog post you mention that postaction gives us the possibility to script this behavior and that’s exactly what i want to accomplish. The only thins is, i don’t know how to script this. How do i wait for the client to be available and then force retrieve policies? I already use the postaction script to do all the finishing touches and shutdown the machine when ready, and i want to incorporate the retrieval of SCCM client policies.
    Thanks for the help and all info i already found here!

    Reply
  8. Chris says:
    August 16, 2017 at 1:01 pm

    Can you do a powershell script and copy it locally and then set the SMSTSPostAction variable to be something like powershell.exe -executionpolicy bypass -file C:\WINDOWS\SMSTSPostAction.ps1?

    Reply
  9. Jörgen Nilsson says:
    August 18, 2017 at 8:38 am

    Sure, no problem will work just fine!
    Regards,
    Jörgen

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

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

My name is Jörgen Nilsson and I work as a Senior Consultant at Onevinn in Malmö, Sweden. This is my blog where I will share tips and stuff for my own and everyone elses use on Enterprise Mobility and Windows related topics.
All code is provided "AS-IS" with no warranties.

Tweets by ccmexec

Recent Posts

  • Windows Servicing, Personal Teams and Success.cmd
  • Windows MDM Security Baseline – Settings Catalog
  • Configuring MS Edge Security Baseline v107 using Settings Catalog
  • Configuring Desktop App Installer using CSP and script?!
  • Customizing Taskbar and Start in Windows 11 22h2 with PowerShell

©2023 CCMEXEC.COM – Enterprise Mobility | WordPress Theme by Superb Themes
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.Accept Reject Read More
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT