Building An Even Better Task Sequence

03/12/2019 – This post has been updated to support changes in 1901 TP and (I assume) 1902 CB to the TSProgressUI.exe ConfigMgr client component used for the custom described dialog below.

Note: You must be running ConfigMgr/SCCM 1810 or higher to use the

_SMSTSLastActionName variable included in this post. However you can use the same concepts and error dialog with previous versions (but seriously, upgrade already!), you just can’t display the name of the failed step as described here. Also, go upvote the UserVoice item to have the product do this natively (Thanks Nash!).

In my Building A Better Task Sequence post, I discussed how to use the new _SMSTSLastActionName Task Sequence variable to capture the name of a failed step and still gracefully exit the Task Sequence. At MMS Desert Edition last week, Mike Terrill used some of my concepts for his MVP Showcase. After the session, Andreas Hammarskjöld from 2 Pint Software suggested that we should be able to customize the error message that is displayed after a failure. I saw him the next morning at the AZSMUG meeting and we quickly chatted about the dialog again. I had about 1.5 hrs before I was scheduled to speak so I figured, why not try to build, test and demo a custom error dialog in that time. Somehow, it worked, so thanks Mike and Andreas for the inspiration. Here’s yet another take on this idea (I have a few more I think. Maybe I need to just number my posts now…).



This post also relies on concepts from my previous

Using SCCM Task Sequence Variables as Scripts post, so if you get lost, go check it out. My goal here isn’t to create some beautiful error dialog, but to give you another option to use to build your solution out.

Picking Up Where We Left Off

The problem we want to solve is this ugly mess of dialog boxes when the Task Sequence fails. One problem is that the error dialog is mostly generic and it hides the ProgressUI, so users may never see our cool modified dialog and we will end up back at the same problem – not getting good info at the time of failure since most users will just screenshot the error dialog and send it in for support.

Example of both dialogs, with the error dialog moved to reveal the Progress UI where the real info is.

In the last post, I showed how to customize the ProgressUI. Now we will hide the ProgressUI and show a custom dialog with the same information that we need from the failed step.

Show/Hide ProgressUI

You may be aware that when you deploy a Task Sequence, you have the option to deploy it silently by unchecking the Show Task Sequence progress on the User Experience tab of your Task Sequence Deployment. The problem with this option is that it hides ALL of the dialogs, which may not be something you want to do — I know my users don’t like to find out they have a new OS installing by having their machine randomly reboot with no warnings! However, if you want to display one of the many custom dialogs available from the ConfigMgr community, unchecking the box may be beneficial. Full list at the end.



Uncheck Show Task Sequence Progress to hide all progress and error dialogs

Another option to consider is the TSDisableProgressUI variable. You can use it anywhere in your Task Sequence to toggle the dialog on or off. Simply add a Set Task Sequence Variable step before or after any step you want to change the dialog display for, then set the value to True or False depending on the desired display mode. Once the variable is set, ProgressUI will stay on or off until you toggle it again.



Toggle ProgressUI On by setting TSDisableProgressUI=False

Toggle ProgressUI Off by setting TSDisableProgressUI=True

Custom Error Dialog

Disabling ProgressUI, allows us to fully control the Task Sequence dialogs. For example, if you wanted to suppress the default dialog and put up a splash screen or simply customize the ProgressUI itself – though that would require adding a step to update the dialog in between each step, which isn’t really the best. I have worked on a script to monitor the TS progress and update the dialog, but it’s quite unstable and unreliable. All that to say, you CAN do it, you just may not want to.

The final result.

Putting it All Together

For my sample Task Sequence, I’m reusing the one from the previous post and just modifying a few steps to give us the desired result. Full TS is is available for download at the end.

03/12/2019 – These steps have been updated for SCCM 1902 CB functionality. The WMI Condition and additonal “Set Custom Dialog” should only be needed if you are running this TS in an environment with 1810 AND newer clients. The change to TSProgressUI.exe is an additional argument has been added to the ShowErrorDialog Method.



The basic TS structure

Sample step that will case the TS to fail with exit code 12345



Condition on the Custom Error Dialog group to only run if there was a failure.

1810 Clients Only

WMI NameSpace: root\ccm WQL Query: Select ClientVersion from SMS_Client where ClientVersion < '5.00.8772.1000'



1810 Clients Only – Setting the CustomDialog variable to our new PowerShell code block.

1901 TP or 1902 CB Clients and Newer

WMI NameSpace: root\ccm WQL Query: Select ClientVersion from SMS_Client where ClientVersion >= '5.00.8772.1000'



1901 Clients and Newer – Setting the CustomDialog variable to our new PowerShell code block.

Remaining Shared Steps

Disable the progress dialog to suppress the default dialogs.

Run Command Line step to run the code block that we stored into the CustomDialog variable.

As you can see, the main changes from the previous post are that we are now toggling ProgressUI off and instead of using a variablized step name as the final step and we are going to call the PowerShell to show the custom dialog, but only AllStepsSucceeded = False.

One more note on this – Instead of customizing the built-in error dialog, you could make your own custom message that provides the user with options to email IT or retry the TS, etc. You get the point.

You can download the full sample Task Sequence from my GitHub.

Community Progress Dialogs

Additionally, check out Gary Block’s post that talks about the _SMSTSUserStarted variable. You can use it to only show the dialog if a user initiated the TS.