I’ve often heard the phrase “MDT solves problems to issues you didn’t even know you had.” And it’s certainly true in this case!!
I was looking for a process or procedure that would allow me to present my current custom OSD front end HTA to an active end-user who is logged into Windows. Unfortunately, standard SCCM task sequences don’t allow this to happen. To workaround this, my first consideration was to run the HTA as a prerequisite of the task sequence, but therein lay another issue with SCCM task sequences – since the HTA was run as a prerequisite Program, it was not technically within the Task Sequence environment and therefore I could not set task sequence variables, etc.
Fortunately the good folks on the MyITForum discussion list were able to steer me in the right direction. MDT 2010 Update 1 contains a standalone executable (ServiceUI.exe) that allows execution of anything (not just an HTA) within a task sequence and enables the end-user to interact with it. To utilize ServiceUI without integrating MDT with SCCM, perform the following:
- Install MDT 2010 Update 1 on your local computer
- Find ServiceUI.exe (for the appropriate target architecture) and put it into the same directory as your HTA front end script(s)
- Create a script that will
a) Make a copy of the HTA on the local executing computer (only if your advertisement is set to “run from server”)
b) Run command: ServiceUI.exe -session:1 %SYS32%\mshta.exe C:\CustomSystemOptions.hta
Note: it’s important to know that the options “-session:1″ will only work if the user logged into Windows has local admin rights. My suggestion is to restart Windows and login as the local Administrator account. - Update your task sequence to include a “Run Command Line” as the very first item in the task sequence
a) Name it something like “Service UI – Custom System Options”
b) Set the command line as “TheNameOfYourScript.vbs”
c) Use the package which contains your scripts
d) CRITICAL: Do not set option “Time-out (minutes)” as this will cause ServiceUI to error!
e) On the Options tab, add a condition to check that TS variable “_SMSTSInWinPE” = false
In short, this should be all that you need to get going to display the HTA to end-user. However, the thing that I do not yet have resolved in this all this is that when connected to a system through RDP, ServiceUI will launch the HTA, but it’s not displayed. Still gotta figure that one out….and then update this post of course ;-)


#1 by jay connor on September 30, 2011 - 4:17 pm
I run a script as a pre-req using the registry to store information I want in the task sequence. When the Task Sequence runs it can then read the registry.
Willl have to play with this.
Thanks
#2 by Nicolas Moseley on September 30, 2011 - 4:53 pm
Great! I hope it works out for your needs…
#3 by Matt on January 24, 2012 - 4:52 am
hey mate, nice article , could come in very handy for a problem i’m working on.
Just a tip – if you use -session:1 , thats always the console session. RDP will be another session, could be 2, or 3 etc. You would need to use some logic to determine the session and set that as a variable for the TS command line.
powershell can manipulate sessions and find the session id for a specific user etc.
#4 by Nicolas Moseley on January 24, 2012 - 6:31 am
Awesome, I appreciate the tip!!
#5 by Texas on January 26, 2012 - 10:25 am
I go to the Interaction tab on your Advertisement and check the box “Show the task sequence progress”. Then run a command line in the task sequence ServiceUI.exe -process:tsprogressui.exe %SYSTEMROOT%\system32\mshta.exe my.hta. Found it on another site and as long as you dont mind moving the progress bar out of the way it is a quick and dirty way to ensure the HTA displays in your current session.
#6 by Nicolas Moseley on January 26, 2012 - 10:29 am
Thanks – I appreciate the additional info!