Partager via


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>

Comments

  • Anonymous
    January 01, 2003
    The comment has been removed

    • Anonymous
      April 07, 2016
      Thanks for this, Mike. It looks realy good.Could you elaborate on how to run the 64-bit version of cscript.exe? I am using the 64-bit boot image from ADK for Win10 (10.0.10240.16384).Also, what would be REALLY cool is some kind of description of the TSProgressUI Object and its properties and methods ;)Thanks Again!
  • Anonymous
    August 24, 2010
    I am using this in an MDT task sequence.  It works fine in a 32 bit OS, but it does not work for me in a 64 bit OS. I realize there are different files for the different architectures.  any reason why this won't work under 64 bit?

  • Anonymous
    September 07, 2010
    Hi Michael, sorry for stupid asking, but how have I to implement the script? As example I want to install some software with AutoIT with sends keystrokes. But if the progressbar is always in front of the software which is installing the keystrokes are send to the progressbar. Do I have to call the script in task sequence or bevor running software installation? Thank you very much Stefan

  • Anonymous
    September 15, 2010
    where can I put this?    ' Hide the progress dialog    Set oTSProgressUI = CreateObject("Microsoft.SMS.TSProgressUI")    oTSProgressUI.CloseProgressDialog    Set oTSProgressUI = Nothing

  • Anonymous
    June 16, 2015
    Is there a SCCM way to show this progress bar in TS which run in logged out computers?