Building application with a purpose of being used in a Task Sequence in ConfigMgr can be accomplished with various methods in different languages. Recently, I’ve started to explore C# and built a couple of applications meant for configuring the task sequence environment. If you for instance are building an application (e.g. a front end) and want to hide the progress UI, run your application and then resume the task sequence from the last instruction, the following code snippets can be handy and hopefully point you in the right direction for your project (shout out to Johan Schrevelius that got me started with loading the ComObject in the first place).

Hide Task Sequence

public static void CloseTSProgressUI()
	Type tsProgress = Type.GetTypeFromProgID("Microsoft.SMS.TSProgressUI");
	dynamic comObject = Activator.CreateInstance(tsProgress);


	if (System.Runtime.InteropServices.Marshal.IsComObject(comObject) == true)

Resume Task Sequence

public static void ShowTSProgressUI()
	Type environmentType = Type.GetTypeFromProgID("Microsoft.SMS.TSEnvironment");
	dynamic tsEnv = Activator.CreateInstance(environmentType);

	Type progressType = Type.GetTypeFromProgID("Microsoft.SMS.TSProgressUI");
	dynamic tsProgress = Activator.CreateInstance(progressType);

	string orgName = tsEnv.Value["_SMSTSOrgName"];
	string pkgName = tsEnv.Value["_SMSTSPackageName"];
	string customMessage = tsEnv.Value["_SMSTSCustomProgressDialogMessage"];
	string currentAction = tsEnv.Value["_SMSTSCurrentActionName"];
	string nextInstructor = tsEnv.Value["_SMSTSNextInstructionPointer"];
	string maxStep = tsEnv.Value["_SMSTSInstructionTableSize"];

	tsProgress.ShowTSProgress(orgName, pkgName, customMessage, currentAction, nextInstructor, maxStep);

	if (System.Runtime.InteropServices.Marshal.IsComObject(tsEnv) == true)

	if (System.Runtime.InteropServices.Marshal.IsComObject(tsProgress) == true)
Nickolaj Andersen
Principal Consultant and Enterprise Mobility MVP. Nickolaj has been in the IT industry for the past 10 years specializing in Enterprise Mobility and Security, Windows deployments and Automation. In 2015 Nickolaj was awarded as PowerShell Hero by the community for his script and tools contributions. Author of ConfigMgr Prerequisites Tool, ConfigMgr OSD FrontEnd, ConfigMgr WebService and a frequent speaker at user groups.


  • Scott Milne
    Posted at 23:39 January 6, 2017
    Scott Milne

    Excellent! Just what I was looking for…It doesn’t seem to pause the TS, however. Only closes the UI.

  • Leave a Reply