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.
Truly a small but great new feature.
11 thoughts on “New Task Sequence Variable PostAction in ConfigMgr 2012 SP1”
place this at the very last step of a TS?
It doesn’t matter where it is placed in the Task Sequence as long as the variable is set it will run anyway.
There can only be one SMSTSPostAction steps correct? I was trying to add 4 of them and it only picks up the last one.
Yes you can only have one command but separating the command lines with $ in the Task Sequence variable will work just fine.
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..?
I think maybe he meant & or &&.
I managed to Uninstall ConfigMgr 2012 Sp1 client agent in TS with variable “SMSTSPostaction”.
Read my tweet:
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!
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?
Sure, no problem will work just fine!