Jump to content


anyweb

How can I pause a task sequence in System Center 2012 Configuration Manager ?

Recommended Posts

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)

serviceUI.png

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 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

task sequence tools folder populated with files.png

Step 2. Add our package to Configuration Manager

In the software library, expand Application Management, Applications, Packages, right click and choose Create Package.

create package.png

fill in some info about the package and set the UNC path of the source of the Task Sequence Tools folder

Task Sequence Tools.png

choose Do Not Create a Program

Do not create a program.png

and continue through the wizard until completion.

wizard is complete.png

Step 3. Distribute our package

Locate the package you just created, right click it and choose Distribute Content.

Distribute Content.png

click next when the wizard appears

Task Sequence Tools distribute content wizard.png

add one or more Distribution Points by clicking on Add and selecting Distribution Point

select distribution point.png

and continue that wizard until it is completed.

distribute content wizard is complete.png

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.

 

Edit Task Sequence.png

 

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).

 

Pause Task Sequence.png

 

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)

 

two pauses.png

 

 

Step 5. PXE boot a client to test the Pause task sequence step.

 

PXE a virtual machine

 

pxe boot.png

 

and select and then start our recently edited task sequence

 

select our task sequence.png

 

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

 

Task Sequence Paused!.png

 

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.

 

cmtrace showing smstslog.png

 

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!

 

click on ok.png

 

 

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.

  • Like 2

Share this post


Link to post
Share on other sites

Its worth mentioning that this method allows any interaction with the user during the Task Sequence... I have used this myself in a upgrade scenario using USMT, and a recovery partitions were causing issues. I added one task to check the partitions on the disk, and ask if the user (IT person) want to delete the recovery partition or not. If the user choose Yes, the partition will be deleted, and a registry key is written to WinPE's registry. The next step is a reboot task with a condition on the registry key. I also choose to run the actual USMT task with with method as well, for to keep an eye on the USMT-output...

Share this post


Link to post
Share on other sites

This is actually very usefull for finding which task sequence is having the trouble. But what would be more helpfull if there a way to un-hide or turn on the task sequences with interactive mode. So that let say you have a command-line TS, and you think there is a problem in the command, the task sequence by default runs that command-line in a hidden window. Don't get me wrong, I like the hidden window for command-line task sequences.... when they work. But let's say you have the syntax wrong or something really stupid like that going on. You would never even see. Unless there is a way that someone out there knows about ?

My current work around is to just create a package for that command-line and then in the program for that package have "Allow users to interact with this program" clicked.

I like this pause and I do use it, but it would be nice to have this feature buitl-in.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.