In some cases it comes in handy to restart or shutdown your task sequence (TS) at the end of the TS. A downside of giving a shutdown or restart command at the end of a TS is that SCCM will not log the TS as finished until the last task is peformed succesfully. This is the moment where “SMSTSPostAction” comes in place.
“SMSTSPostAction” is a TS variable which you can set at the end of a TS with a certain value/command. It will perform this action when the end of the TS is reached and the TS has finished succesfully.
At this moment I mostly use this variable for performing the last reboot for the device which is deployed. But you can also choose to shutdown the machine if you prefer that. Underneath a example how I use this at the moment.
Underneath some value’s / commands which can be usefull to perform at the end of a TS using this variable.
-
1234567891011:: Restart device:cmd /c shutdown /r /t 0 /f:: Shutdown devic:cmd /c shutdown /s /t 0 /f:: Group Policy update with a reboot:gpupdate /force /boot:: Run a specific script:C:\temp\<filename>.<extension>
:: Run a specific script:
C:/temp/.
Shouldn’t those be backslashes?
Yes they should, adjusted the script, thank you!
Keep in mind that the command “gpupdate.exe /Force /Boot” may not always produce the desired Reboot. “/Boot – This option has no effect if there are no extensions called that require a restart.” What may only occur is a forced logoff.