With Service Pack 1 for SCCM 2012, Microsoft introduced a few new task sequence variables. The one in the spotlight for this post is: SMSTSPostAction.
The SMSTSPostAction variable can be defined anywhere in the task sequence with a “Set Task Sequence Variable” step. Its value can be any command you wish, like:
- Shut down the computer
Command: shutdown /s /t 0 - Run a PowerShell script (the script needs to be copied to the computer during the task sequence)
Command: powershell -File “%TEMP%\Do-SomeStuff.ps1” -ExecutionPolicy ByPass
This command is executed right after the task sequence was successfully completed. In the smsts.log the second last entry shows your post action command:
Log Text | Component |
---|---|
… | … |
Successfully removed C:\WINDOWS\system32\OSDSETUPHOOK.EXE | OSDSetupHook |
Successfully removed C:\WINDOWS\system32\_SMSOSDSetup | OSDSetupHook |
End program: [your command] | OSDSetupHook |
Successfully finalized logs to SMS client log directory from C:\WINDOWS\CCM\Logs | OSDSetupHook |
Principal Security Consultant | MVP at baseVISION AG
I’m a consultant, trainer and architect for modern workplace and enterprise mobility projects with Microsoft Technologies in the past ten years. I love to push and design the modern workplace based on Microsoft 365 for my customers which is the only answer for the current security threats, agile world and the fast-changing business requirements of my customers. Important for me is to simplify and automate the operational processes, because there are the highest costs.
Follow me
Latest posts by Thomas Kurth (see all)
- Exploring Baden, Switzerland: An Evening Guide for Workplace Ninjas Conference Attendees - August 15, 2023
- Unveiling a new version of M365Documentation PowerShell Module: Creating Markdown Documentation with Ease - July 22, 2023
- Microsoft Purview Information protect predefined permission groups demystified - February 28, 2023
0 Comments