SCCM Use HTA To Set Task Sequence Variables

/ June 21st, 2011/ Posted in Configuration Manager, Desktop / 5 Comments »


I configured a task sequence to begin deployment of Windows 7 via USB thumb drives which are given to the techs. I wanted them to be able to install optional software at the time of deployment.



Using Groups within the Task Sequences assigned variables gave me the best method of doing so. I created a front end HTA to allow the techs 1. set the PC name 2. add any additional software that the user might have had on their XP or replaced PC.

1.Mount current boot.wim file and then add HTA packages (if you dont already have HTA support)

Dism /image:c:\mountedwim /Add-Package /PackagePath:”C:\Program Files\Windows AIK\Tools\PETools\%Architecture%\WinPE_FPs\”
Dism /image:c:\mountedwim /Add-Package /PackagePath:”C:\Program Files\Windows AIK\Tools\PETools\%Architecture%\WinPE_FPs\en-us\”

2. Refresh/update boot image in SCCM

3. Configure Task Sequences to launch HTA

4. Configure groups with Task Sequence Variables

5. Configure HTA file
(right click and save-as a text file and then rename to .hta once downloaded)
modify it to match your task sequence variables and the correct value it should be.
Keep in mind this will throw an error when not in the WinPE environment.

6. Deploy Image to USB Drive
No need to set variables on the Task sequence itself. When the image boots up and begins task sequence the HTA will run and prompt for check boxes and computer name value.


  1. JB
    2013/10/06 at 12:00:49

    Hi, when I run HTA in TS, I always the TS progress bar window on top of the HTA window. Is it a way to get the HTA window always on top?

  2. Mike
    2013/08/06 at 12:27:22

    This is possibly one of the WORST posts i have come across regarding using HTAs in SCCM task sequences!! It will not work for many many reasons.

    1) Step 3 will not work, you cannot simply reference an HTA file, it will not run, it is not an executable. You must use mshta.exe to run it.

    2) Step 3 will not work, because you are using a package with source files, yet at that point in the task sequence, you have not partitioned the hard disk, so the files cannot be copied to the local package cache.

    3) Your HTA will not function as intended, there are errors in it.

    4) Your HTA is poorly written and inefficient, lots of duplicate or unnecessary code, even in terms of simplification for this post.

    Jamie – Why bother to share you advice, when it will simply cause people more problems than they already have??

    • Jamie
      2013/08/06 at 19:33:10

      You obviously missed the entire point of the post. It is to set variables to a specific value. I am not installing any software via the HTA.

      There are “errors” because you have to launch it inside of the WinPE environment. It requires classes and DLLs that are only loaded into memory when in the WinPE mode.

      Believe me, I’ve seen worse.

      Thanks for the comment though.

  3. halcoberry
    2012/04/03 at 23:05:01


    Just thought I would add that I recently made a blog post on how to do this
    linky here if you are interested 🙂

    • Jamie
      2012/04/05 at 13:22:33

      yeah that’s a nice article as well.

Leave a Reply

Name required

Please Submit Answer * Time limit is exhausted. Please reload CAPTCHA.