Can I display a HTA during existing OS rebuild task sequence (SCCM-OSD) RRS feed

  • Question

  • Hi all, I've been trying to find a way to make this work for a couple of days now... and just can't make it happen.

    I have a single TS which caters for my "New Computer" and "Existing Computer" builds.

    For my "New Computer" builds I have a HTA which is executed during the PXE boot process,  the HTA is launched via the TSConfig.ini file within the boot image and works perfectly. It sets a number of TS variables which the remainder of my TS utilises these as designed.

    My issue is with my "Existing Computer" builds. I want to be able to have a non-mandatory advertisement which allows a user to kick off a rebuild of their client when ever they choose. The advertisement and launch of the appropriate TS is not a problem, the issue is that how do I get the required HTA to launch within the existing client OS (XP)?

    I've tried adding the HTA to my MDT Toolkit scripts and utilising a Run command task. Which seems to execute the HTA, but it's not visable on the client. MSHTA.exe is in the process list but the HTA GUI is completely hidden. I've also tried placing the HTA in a dedicated application package and setting the properties of my TS to "run another program first" and execute the HTA program. In this case the HTA is displayed, but the "Microsoft.SMS.TSEnvironment" object fails to initialise....
    I've tried VBWappers and Batch files... I just don't know if it's possible?? I'm really trying to avoid having multiple mechanisms to achieve the same result.

    If anyone has either successfully done this, or has new ideas... I love to hear about it. :)

    Thanks in advnce.

    David M.

    Wednesday, June 24, 2009 6:24 AM


All replies

  • the HTA is supposed to run in the WinPE section of the OS deployment, so could you change it to happen then instead ?
    My SCCM Guides http://www.windows-noob.com/forums/index.php?showforum=44
    Wednesday, June 24, 2009 12:54 PM
  • The only thing I can think is to use scenario two above (program dependency) but rewrite your HTA to drop the data into an XML file (or CSV or whatever you're comfortable with) instead of ts variables. Then write a stand-alone, no UI script that you run from the TS to pick up the data from the data file and then write to ts variables.
    Jason | http://myitforum.com/cs2/blogs/jsandys | Twitter @JasonSandys
    • Marked as answer by Garth JonesMVP Monday, December 28, 2015 5:50 PM
    Wednesday, June 24, 2009 1:49 PM
  • I created an hta named preTS.hta.  I placed this file in a package without a program.  I then used a "run command line" task and pick the package and put preTS.hta in the command line: box.  I placed the task sequence item right after "Restart in WindowsPE".  It works perfectly every time.  I am using it to build Windows Server 2008 x64 but assign the TS to an x86 boot image in which I added all the support for HTA, Scripting, WMI, etc.

    The way I understand it:

    1.  PXE boot boots to x64 boot image because it's x64 hardware.  (or x86 if it's x86 hardware)

    2.  When the TS takes over it boots into the boot image assigned to the task sequence

    I use the x86 boot image for everything.  I leave the x64 boot image there just for the initial PXE boot.  I find it easier to modify the x86 image because some of the MDT tools have issues with SYSWOW64 related to calling system files without a path and the calls failing.  It's not impossible to use x64 boot image I just find it easier to use x86 without all the hassle.

    Wednesday, June 24, 2009 2:00 PM
  • Jason, your solution meets my requirements... Thank you. I should have thought of that myself as I already use that approach for another requirment... I guess I had my blinkers on looking for the cleanest solution.

    Niall & minccum, the reason I don't want the HTA to execute after a reboot into WinPE, is that these rebuild will be driven by the end user, so I need any pop-up's to appear ASAP after they launch the task sequence. Even though it's only a minute or two to download the WinPE WIM and restart... as soon as the user see's a reboot they think the process is under way and their off to make their coffee :). Then when they come back 20 minutes later the client is still sitting at the HTA screen asking for input, with the whole build process still ahead of it.

    It's frustrating that the "full" HTA support only works from within the WinPE environment. I don't understand the difference, why is it supported in WinPE but not the client OS ?? Anyway, OSD work around #14 here we come.

    Thanks for you assistance guys.

    David M.
    Wednesday, June 24, 2009 10:42 PM
  • Another thing you can try. Download the SCCM SDK and install it. Look under C:\Program Files\Microsoft System Center Configuration Manager 2007 SDK\Samples\OperatingSystemDeployment\UnknownSystem\VBScript There is a VBS script that customizes the WinPE boot disk and then adds it to the Win PE image and then adds this data to SCCM. You could use the VB script to see how they are doing the modification to WinPE. You could also add to the Current Unknown HTA your HTA pieces. 

    Now the legal stuff:
    This is just a though and this is not supported by me or Microsoft and is just information presented as is. ;)
    Wednesday, July 1, 2009 8:52 PM
  • Now the legal stuff:
    This is just a though and this is not supported by me or Microsoft and is just information presented as is. ;)

    I'll sue you if it doesn't work! ;-)
    Friday, July 24, 2009 4:16 PM
  • This is an old thread, but I just came across this page with what seems a good solution to the problem:
    Tuesday, August 18, 2009 2:57 PM
  • I also read somewhere that TS run from inside Windows execute code under the System account which does not have interactive to the desktop user  rights. This explains why your .EXE can appear in the TaskMan but there is nothing in on the screen. 

    AFAIK  you need to figure out how to execute the HTA under a User context or an account that can interact with the desktop. 

    Thursday, July 1, 2010 12:35 PM
  • Maybe this is the solution:

    You can tell every task sequence "run another program first". There you can define a program/package that interacts with the user.

    This program can write a file with your variables and than the tasksequence can read this file.


    Is that the answer?

    Wednesday, August 18, 2010 1:31 PM
  • Maybe this is the solution:

    You can tell every task sequence "run another program first". There you can define a program/package that interacts with the user.

    This program can write a file with your variables and than the tasksequence can read this file.


    Is that the answer?

    Yes it is. Well at least in my case this is the process I've utilised. The "run another program first" option is not executed during a PXE boot execution of the task sequence, but it is when the TS is executed from the user desktop (Run Advertised Programs in Control Panel). The pre-execution package is simply one with the required HTA in it and a program configured to launch that HTA (mshta.exe).

    The HTA has been confiured to record the users responses to a text file on the local disk and then the task sequence is configured with an additional step (Run Command Line executing a VB script) which checks for the existance of the txt file and if found reads in the responses and assigns them to TS variables.

    The HTA is also configured as the first task (Run Command Line) within the TS, but the task is only set to be run if the _SMSTSinWinPE variable equals TRUE. This way I get to utilise the same HTA in the same package for both OSD mechanisms, PXE boot and User Interactive Rebuild. It works really well. :-) Sometime the old ways are still the best.

    Appologies for not posting my resolution sooner.... to be honest I completely forgot about this post. :-) Hope this helps out someone else.

    Wednesday, August 18, 2010 10:44 PM
  • I use the same method as DAvmatt to display a password prompt that the user must enter correctly before it will allow them to upgrade or run a task sequence that will wipe user data. 


    Friday, August 20, 2010 7:19 AM
  • I believe this document will help you.


    works very well for me.

    %ToolRoot%\ServiceUI.exe -process:tsprogressui.exe %SYSTEMROOT%\system32\mshta.exe %ScriptRoot%\MyCustomHTA.hta

    Jacob Andrade
    Wednesday, March 16, 2011 12:39 PM
  • I created a vbscript and I put properties from my Task Sequence to run this script first. You need create a Package with ServiceUI, VBS and HTA files and the Programm with this vbs as command line:

    Option Explicit Dim ReturnCode Dim objShell : Set objShell = CreateObject("WScript.Shell") Dim GetScriptPath : GetScriptPath = Left(WScript.ScriptFullName, InstrRev(WScript.ScriptFullName, "\", -1, 1) - 1) '********** '* MAIN * '********** ReturnCode = objShell.Run ("cmd /c " & GetScriptPath & "\ServiceUI.exe -process:TsProgressUI.exe %SYSTEMROOT%\SYSTEM32\mshta.exe " & GetScriptPath & "\myhta.hta", 1, True) Wscript.Quit(ReturnCode)

    Tuesday, February 2, 2016 4:04 PM