Introduction
Sometimes things don’t go as planned, you are deploying an operating system to a computer and the task sequence fails. You can use normal troubleshooting methods such as
- press F8 and review the smsts.log in CMTrace
- review a report of the task sequence progress
- review other OSD related logs
- review application or package content status
or you can take things one step further and add the ability to pause everything in your task sequence (much like debuggers can step through commands on a compiler).The ability to pause a task sequence gives you the power to perform diagnosis during a deployment and also means that you can monitor a step while it’s happening (to check how variables are being set/read/or whatever) rather than reviewing the logs after the event (sometimes the logs will roll over and you’ll miss the failure altogether).
This method uses serviceUI.exe from the Microsoft Deployment Toolkit. You do not need to use MDT or have MDT integrated with Configuration Manager to use this method.
Step 1. Prepare a package containing the required files
In this guide we’ll use ServiceUI.exe from the MDT 2012 Update 1 files package. This file allows us to popup messages and run interactive actions with users while in SYSTEM context. Simply locate the exe (found by default in C:\ProgramFiles\Microsoft Deployment Toolkit\Templates\Distribution\Tools\X86)
and copy it into a new folder called Task Sequence Tools.
Note: There are two versions of ServiceUI.exe, one is 32 bit (in the X86 folder) and the other is 64 bit (in the X64 folder). The boot image attached to your task sequence will decide which version of ServiceUI.exe you need to use, so if you are using a 32 bit boot image, you must use the X86 version of ServiceUI.exe otherwise you’ll get an error when trying to run it.
Download pause_ts.vbs.txt 408bytes 6 downloads and copy it into our Task Sequence Tools folder. Rename the file from pause_ts.vbs.txt to pause_ts.vbs so that our folder looks like this
Step 2. Add our package to Configuration Manager
In the software library, expand Application Management, Applications, Packages, right click and choose Create Package.
fill in some info about the package and set the UNC path of the source of the Task Sequence Tools folder
choose Do Not Create a Program
and continue through the wizard until completion.
Step 3. Distribute our package
Locate the package you just created, right click it and choose Distribute Content.
click next when the wizard appears
add one or more Distribution Points by clicking on Add and selecting Distribution Point
and continue that wizard until it is completed.
Step 4. Add the Pause Task Sequence step to a task sequence
In Operating Systems, browse to Task Sequences and locate a task sequence you want to troubleshoot, and right click on it and choose Edit.
in the task sequence editor, locate a section of the task sequence that you want to troubleshoot and click on the drop down menu Add, then select General, and Run Command Line.
give the step a suitable name like ##### Pause Task Sequence, the ##### makes the line stand out in a big task sequence which makes it easier to find later (so that you can remove it once you’ve fixed the problem).
Tip: you should place a Pause Task Sequence step directly before and directly after the step (or Group) you want to monitor, and that step should also have the option ‘continue on error’ selected during troubleshooting. This will mean that the task sequence will pause before and after the section of the task sequence that you are having trouble with, allowing you time to review logs, gather files, determine the issue.
and in the command line paste in the following
serviceUI.exe -process:TSProgressUI.exe %SYSTEMROOT%\System32\wscript.exe pause_ts.vbs
then browse and select our Task Sequence Tools package as in the screenshot below (the screenshot below has two pause steps, this is so that you can check logs before and after the step that is causing you trouble in the task sequence)
Step 5. PXE boot a client to test the Pause task sequence step.
PXE a virtual machine
and select and then start our recently edited task sequence
you can either wait until it gets to the pause task sequence step or go away and do some other chores (that’s the beauty of this, you can go away and when you come back the task sequence is paused waiting for you to troubleshoot.)
When you get back, the task sequence will be paused and you’ll see this
and that of course means that you can press F8 and do some deep diving (with CMTrace showing smsts.log live) to find out why your step is failing.
Once you are ready to continue the task sequence, press ALT/TAB to flick through windows on your virtual machine, click on OK on our pause task sequence step and watch the action live in CMTrace!
Summary
You can pause a task sequence using a simple script in conjunction with ServiceUI.exe (or by using a script in MDT Files and access that script directly after a Use toolkit Package step). Pausing a task sequence allows you to quickly get real time results and data in a failing task sequence, once you enable this ability in a task sequence you’ll never look back !
have fun, cheers
niall.