Script to Make ServiceUI.exe Easier to Use for OSD Custom User Interfaces

Since Configuration Manager task sequences usually run as the System account, the task sequence cannot natively launch and display a user interface that will be visible on the screen.  So MDT ships with an utility called ServiceUI.exe that allows executable to display on a different desktop than the System desktop (which is not visible).  This executable is used by UDIWizard.wsf to display the UDI Wizard when needed.

I recently has a requirement for a UI that could not be met with the UDI Wizard.  So I created custom HTML Applications (HTA) for this instead.  You can find various articles on the web that describe using ServiceUI.exe with other user interfaces like HTML Applications like this one: https://blogs.technet.com/b/cameronk/archive/2011/01/25/can-i-use-serviceui-exe-to-launch-other-programs-besides-the-udi-setup-wizard.aspx.  But to use it correctly, you have to make sure to pick the correct process for ServiceUI to use to find the correct desktop on which it will display the custom UI.  There are also other things that UDIWizard.wsf takes care of in its code, like dismissing the task sequence progress UI before displaying the custom UI.

So to get the benefits of using the code in UDIWizard.wsf with any other UI executable, I basically took the code from UDIWizard.wsf, removed all the UDI Wizard handling code, and add the bits to launch another executable.  The new script, MDTRunWithServiceUI.wsf, should be added to the Scripts folder of the ConfigMgr MDT Toolkit package.  It should be run with a Run Command Line step and has a command line syntax as show in this example:

cscript "%DeployRoot%\Scripts\MDTRunWithServiceUI.wsf" /UIExePath:"%SystemRoot%\System32\mshta.exe" /UIExeParam:"%DeployRoot%\Scripts\MyHTA.hta"

where /UIExePath is the path of the executable to launch and /UIExeParam is the optional command line parameter to pass to the executable.  (If you look at the script header you will notice an additional command line switch of /UIExeTitle.  I some instances when launching our task sequence from Software Center, the HTA would pop up behind Software Center instead on top of it.  The code run by this switch was my attempt to launch a VBScript on the same desktop to attempt to “activate” the window and make it topmost.  As you can see from the notes in the header I have not be able to get this to work.  If any of you do figure this out, post back a comment on how you did it).

MDTRunWithServiceUI.wsf is provided below.

 

Disclaimer: The information on this site is provided "AS IS" with no warranties, confers no rights, and is not supported by the authors or Microsoft Corporation. Use of included script samples are subject to the terms specified in the Terms of Use .

This post was contributed by Michael Murgolo, a Senior Consultant with Microsoft Services - U.S. East Region.

MDTRunWithServiceUI.zip

Comments

  • Anonymous
    November 13, 2015
    The comment has been removed
  • Anonymous
    December 02, 2015
    Thank you Michael! I've been looking for a more professional way to start a TS, so end users have less confusion and frankly, so it looks more professional. I added a step before the step calling your script to PSKill SCClient (Software Center). I know it's not ideal but in all my testing I see no harm from killing it this way and it does what you and I both wanted, closes Software Center so the Password GUI is the only visible part of the TS. With the TS set to fully download before starting, everything runs in order with no long (confusing) gaps with nothing happening...

    Thanks again!

    Jack