Share via

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