Useful Script Number 6 – Pausing the Task Sequence

Have you ever wanted to pause the task sequence in MDT 2008 or ConfigMgr 2007 for a few seconds while something catches up...? I had a requirement to do this recently where I ran a task to close and cancel the Windows Sidebar at the start of the State Restore phase of the task sequencer and then turn the Windows Sidebar back on again at the end of the State Restore phase - I was doing this as the Windows Sidebar can sometimes get in the way of some customisation scripts and you can also see peculiar VB messages when 2007 Office System updates are applied. When the Windows Sidebar is turned back on, there is a couple of seconds before the Sidebar actually appears - yet my task for turning on the Sidebar had returned and the task sequence had moved made be think that there may be other situations where a slight delay in returning to the task sequence may be useful - sure you could add sleep commands to the scripts that your running as commands - but that doesn't help with the tasks that are not scripted - so here is an MDT based script that will pause the task sequence for a specified number of seconds (specified on the command line)

I first have a couple of variables to store the time to pause (strTime) and the script name (strSName - for logging purposes) and the integer argument for the sleep method

Dim strTime, strSName, IntTime


...I then use a call to ZTIUtility.wsf to set the script name to the strSName variable - this is then used to insert the script name at the start of each line in the log.


...then it's another call to ZTIUtility.wsf to use the arguments class - this makes passing input to the script via the command line easy - in this case I am setting a command line input called "Time"

strTime = oUtility.Arguments("Time")

oLogging.CreateEntry strSName & ": Starting Actions ********************************************* ",LogTypeInfo

...then I check that Time has been specified as a command line input (exit if not) or set the IntTime to number of seconds from the command line x 1000 to get milliseconds

If strTime="" Then
    oLogging.CreateEntry strSName & ": No pause time was specified on the command line.",LogTypeError
    Exit Function
    oLogging.CreateEntry strSName & ": Pause time has been set to " & strTime & " seconds",LogTypeInfo

    IntTime = strTime * 1000 
End if

...I then take the intTime (in milliseconds) and add it to the sleep method to pause the script

oLogging.CreateEntry strSName & ": Task Sequence will pause for " & int(IntTime/1000) & " seconds",LogTypeInfo

wscript.sleep intTime

oLogging.CreateEntry strSName & ": Task Sequence has been paused for " & int(IntTime/1000) & " seconds - returning control to the Task Sequence now",LogTypeInfo

oLogging.CreateEntry strSName & ": Completed Actions ********************************************* ",LogTypeInfo
ZTIProcess = 0
End Function

The script is called CFG-TSPause.wsf so the command line to run it would be CFG-TSPause.wsf /Time:xx (where xx = the number of seconds that you want to pause the task sequence for) Drop the script into your <Deployment Share>\Scripts directory. You can then add the script anywhere in your task sequence by adding a Run Command Line task and specifying the script and the command line input for the number of seconds you want to pause.



As usual, the full script is up on the Deployment Guys SkyDrive:

This post was contributed by Richard Smith a Senior Consultant with Microsoft Services, UK.

Comments (12)
  1. Anonymous says:

    Hi Ben,

    just came up with another solution 🙂 just wrote a little vbs-script.

    Dim tsarg

    tsarg = wscript.arguments(0)

    seconds = CInt(tsarg)

    milliseconds = seconds*1000

    WScript.Echo("Will pause for " & seconds & " seconds.")


    In the TS i'm running the command "cscript.exe %scriptroot%Pause.vbs 60".

    Thanks for your help 🙂



  2. doxley says:


    Have you placed your WSF script in the Scripts folder (%DEPLOYROOT%Scripts)?  If you look in the first 2 lines of the file you will see that there is a relative path to the ZTIUtility.vbs file.  If your script cannot find this file in the relative path you’ll get this error.



  3. Ben Hunter says:

    Hi Alex,

    MDT now has this functionality built-in, I now recommend that you use the approach outlined by Michael Niehaus here –…/mdt-2010-new-feature-3-suspend-and-resume-a-lite-touch-task-sequence.aspx



  4. Anonymous says:

    Hi Deployment Guys,

    Sharing a question we posted to MDT team’s blog

    Using SCCM 2007 R2, we really need to

    – First, Stop a task sequence at a specific step

    – Second, Restart the task sequence from the step at which we stopped.

    We do NOT want to Pause.

    By stop we mean, "Stop and Exit" from the running task sequence.

    By restart we mean, "Start" the task sequence newly but from a specific step.

    Questions we posted at Microsoft forums are here:-

    1. Stop and Start SCCM OSD Task Sequence –

    2. SCCM OSD Task Sequencer executable/script internals –

    3. Running OSD Task Sequence state information and restart from specific step –

    Any bit of information and guidance shared is appreciated.

    Thanks & Regards,

    Chirag Goradia

  5. Anonymous says:

    Hi Ben,

    thank you for your response.

    yeah – i know about the LTISuspend.wsf script, but i only want the TS to be paused for a specific ammount of time and resume afterwards by itself.

    As far as i've read, this is not possible with LTISuspend.wsf.

    Do you know any script or something what will bring me this need?



  6. thomas says:

    Hi guys

    Can you please check the SkyDrive. I am not able to download the pause file. Thank you.

  7. Mark Heppner says:

    Why am I getting this error message in the smsts.log.

    Windows Script Host: Cannot retrieve referenced URL : ZTIUtility.vbs

  8. Rich says:

    I am running into an issue after the "Pause the Task Sequencer" step is executed.  My bdd.log file says: Non-Zero Return Code executing command, "C:MiniNTToolsX86TsmBootstrap.exe /env:SAContinue, rc=2147467259"

    The ‘Pause the Task Sequence’ step executes and then seconds later kills the T.S.

    Any ideas on what is causing this?



  9. FM says:

    Guys really need some help…. I am trying to install windows 7 with sccm and all runs well until the regional settings appears and requires input and some other settings like pc name etc? i thought this would be picked up from the sysprep xml answer file specified in the task sequence. it appears some things are applied like account creation but im trying to make this zero touch… please help…. once i have entered the required input the install continues… what have i done wrong? I cant see where this can be set in the task sequence…

  10. Download of the script says:


    where can i download the file? There's no working link to the script.



  11. Dunga says:

    Simple: "Timeout 60"

  12. Richard says:

    Very helpful as always guys. Thankyou!

Comments are closed.

Skip to main content