Hiding (and showing) the task sequence progress dialog box

fThe task sequencer used in MDT 2010 and ConfigMgr 2007 is designed to show you at all times what’s going on with your task sequence:

image

As a result, it forces this dialog to be on the top of all other windows, which can be annoying in some situations because you want to get this out of the way.  I’ve seen various solutions for this, typically that just move the dialog out of the way (to the edge of the screen, off the screen, etc.).  But there’s a much easier way to do this:  you can just tell this dialog to close itself using a very simple script:

' Hide the progress dialog

Set oTSProgressUI = CreateObject("Microsoft.SMS.TSProgressUI")
oTSProgressUI.CloseProgressDialog
Set oTSProgressUI = Nothing

That causes the progress dialog to close (not surprisingly) – at least until it is told to update the progress, something that would typically happen at the start of the next step.  So it’s only gone temporarily, but that’s OK – in most cases, you just want it to be gone for one step anyway, so have that step run a VBScript that hides the dialog, does its work, and then exits.

If you did want the progress dialog to show up again before the next step, you can force a progress update.  If you are referencing the MDT ZTIUtility.vbs script, this is pretty simple too because it already has a function to do this.  Just include logic like this:

' Report progress to get the dialog to show up again

oLogging.ReportProgress "Done", 100

If you aren’t using ZTIUtility.vbs, you can add some logic like this:

Public Function OpenProgressDialog

    Dim oProgress
    Dim uStep
    Dim uMaxStep

    ' Try to create the progress UI object

    On Error Resume Next
    Set oProgress = CreateObject("Microsoft.SMS.TSProgressUI")
    If Err then
        Err.Clear
        Exit Function
    End if
    On Error Goto 0

    ' Update the progress

    On Error Resume Next

    uStep = CLng(oEnvironment.Item("_SMSTSNextInstructionPointer"))
    uMaxStep = CLng(oEnvironment.Item("_SMSTSInstructionTableSize"))
    Call oProgress.ShowTSProgress(oEnvironment.Item("_SMSTSOrgName"), oEnvironment.Item("_SMSTSPackageName"), oEnvironment.Item("_SMSTSCustomProgressDialogMessage"), oEnvironment.Item("_SMSTSCurrentActionName"), (uStep), (uMaxStep))

    On Error Goto 0

    ' Dispose of the object

    Set oProgress = Nothing

End Function

If using ZTIUtility, the complete script could look like this:

<job id="Scripting201">
   <script language="VBScript" src="ZTIUtility.vbs"/>
   <script language="VBScript">

    ' Hide the progress dialog

    Set oTSProgressUI = CreateObject("Microsoft.SMS.TSProgressUI")
    oTSProgressUI.CloseProgressDialog
    Set oTSProgressUI = Nothing

    ' <Do your work here>

    ' Show the progress dialog (using one of these methods) if you don't want to wait

    oLogging.ReportProgress "Done", 100

    ' <Maybe do some more work>

   </script>
</job>

If you aren’t using ZTIUtility.vbs, it gets a little longer:

<job id="Scripting201">
   <script language="VBScript">

    ' Hide the progress dialog

    Set oTSProgressUI = CreateObject("Microsoft.SMS.TSProgressUI")
    oTSProgressUI.CloseProgressDialog
    Set oTSProgressUI = Nothing

    ' <Do your work here>

    ' Show the progress dialog (using one of these methods) if you don't want to wait

    OpenProgressDialog

    ' <Maybe do some more work>

    ' The OpenProgress Dialog method gets the dialog to show up again

    Public Function OpenProgressDialog

        Dim oProgress
        Dim uStep
        Dim uMaxStep

        ' Try to create the progress UI object

        On Error Resume Next
        Set oProgress = CreateObject("Microsoft.SMS.TSProgressUI")
        If Err then
            Err.Clear
            Exit Function
        End if
        On Error Goto 0

        ' Update the progress

        On Error Resume Next

        uStep = CLng(oEnvironment.Item("_SMSTSNextInstructionPointer"))
        uMaxStep = CLng(oEnvironment.Item("_SMSTSInstructionTableSize"))
        Call oProgress.ShowTSProgress(oEnvironment.Item("_SMSTSOrgName"), oEnvironment.Item("_SMSTSPackageName"), oEnvironment.Item("_SMSTSCustomProgressDialogMessage"), oEnvironment.Item("_SMSTSCurrentActionName"), (uStep), (uMaxStep))

        On Error Goto 0

        ' Dispose of the object

        Set oProgress = Nothing

    End Function

   </script>
</job>