Jump to content




anyweb

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



Recommended Posts

anyweb    399

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


anyweb    399

and now it is :)

Share this post


Link to post
Share on other sites
bcunjak    2

This is by far one of the best ways I have seen to troubleshoot a TS instead of sitting and waiting for the part where you think the issue is and looking through logs waiting for the error.

Share this post


Link to post
Share on other sites
tomstian    0

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

sure thing

Share this post


Link to post
Share on other sites
DietzCJ    0

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

Hello Everbody,

I think I've got a big problem.

Scenario:
I want to execute a .exe file which interactes with an existing process. The existing process runs under user context with session id 1.
Deploying a task sequence with serviceUI.exe -process:TSProgressUI.exe doesnt' work, because the task sequence and all following processes run under system context, so the process cannot interact with
the existing process.
When deploying a normal task sequence (without serviceUI.exe) and checking run this step as the following account, the task sequence runs under session id 0.

Basically, is there a possibility in SCCM 2012, to deploy or just execute a programm/skript with user interaction which can interact with a user context process in session 1?

Share this post


Link to post
Share on other sites
Aurock    0

Will this work in later parts of the task sequence, such as during the State Restore phase? Or does the F8 for cmd prompt only work during the WinPE phases?

Share this post


Link to post
Share on other sites
anyweb    399

it will work during WinPE or Windows stages of the task sequence as long as it's not during Windows setup (device driver detection stage)

Share this post


Link to post
Share on other sites
vincelewin    2

Hi Anyweb,

 

I tried this in my windows 10 TS and it throws this error.

 

Failed to run the action ###########Pause Task Sequence. This version is not compatible with the version of windows your running. Check your computer's system information and then contact the software publisher. (Error: 800700D8; source: Windows)

 

Im using the serviceUI.exe from the MDT2012 Update 1 you linked above.

Im using a 64 bit boot image and the 64bit version of the serviceui.exe file.

 

Any idea why this isnt working?

 

Regards

 

Vince

Share this post


Link to post
Share on other sites
anyweb    399

hi, which version of ConfigMgr are you using and what ADK/WinPE ?

Share this post


Link to post
Share on other sites
vincelewin    2

Hi,

 

ADK 8.1 Build 8.100.26866

WinPE 6.3.9600.16384 is the boot image version.

ConfigMgr I think its 5.

 

Vince

Share this post


Link to post
Share on other sites
anyweb    399

hmm it should work can you show me a screenshot of the error

Share this post


Link to post
Share on other sites
vincelewin    2

Hi,

 

I think it was giving the error and crashing out because I didnt have "Continue on error" ticked. Now it just flashes up the title and skips past without stopping or display the window.

 

post-19661-0-31666000-1456243418.png

 

post-19661-0-51229400-1456243494.png

Share this post


Link to post
Share on other sites
anyweb    399

that's just parsing the step, that isn't the actual step where it's failing, show me where it's failing or better yet attach the edited smsts.log file here.

Share this post


Link to post
Share on other sites
vincelewin    2

Is it the 401 - Unsuccessful with anonymous credentials error?

 

It is shortly followed by an attempt to use the context credentials.

 

401 - Unsuccessful with context credentials error?

Share this post


Link to post
Share on other sites
vincelewin    2

But heres the error from the log I saw.

 

![LOG[Failed to execute command line 'C_SMSTaskSequencePackagesCOR0012AserviceUI.exe -processTSProgressUI.exe XWINDOWSSystem32wscript.exe pause_ts.vbs' .
This version of is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher. (Error 800700D8; Source Windows)]LOG]!time=085230.146+00 date=02-24-2016 component=InstallSoftware context= type=3 thread=1176 file=runcommandline.cpp562

Share this post


Link to post
Share on other sites
anyweb    399

are you SURE you are using the correct architecture of the serviceui.exe file ? if you took it from the wrong folder it won't work.

  • Like 1

Share this post


Link to post
Share on other sites
vincelewin    2

Hmm,

 

Its a 32bit boot image installing a 64bit OS.

 

Would I use the 32 or 64bit version?

 

I think I know what you are going to say and I think I know what I have done wrong now.

 

V

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×