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.