The Low-Down

In our environment we have more than a handful of different laptop and desktop models that we deploy to end users.  On top of that, we are in the midst of a “refresh” were we upgrade out of warranty machines to newer models.  We are a Dell shop by the way.

A little while back I finally got our OSD infrastructure up and running and worked out all of the nuances and intricacies of it as it relates to our business practices.   In the interim I settled on utilizing the Microsoft Deployment Toolkit (MDT) and integrating it with System Center Configuration Manager (SCCM) by customizing their pre-built task sequences for installing images.

Unfortunately, this was not a one-size-fits-all approach due to the structure and underlying rules resident in our environment.  For example, some computers are destined for a specific department and based on that certain applications would be installed on the computer.  This (and other such criteria) led me to have to create a separate task sequence for each and every possible deployment scenario.  Needless to say, this was painful and a nightmare to maintain.

So I thought, “wouldn’t it be cool if we could have some sort of wizard that pops-up and you could input all of this information?”  Furthermore, it’d be even cooler if I could have only one task sequence that will work for each and every possible scenario.

HTA’s to the Rescue

So I decided to create an HTA that would allow our Help Desk group to select the model specific image, destined department and software to deploy all in one wizard.  The specifics of the HTA aren’t important but there are a few things that must be in place in order for this to work properly.

Getting this to Work

So what specific things should you be aware of and/or have configured correctly in order for this to work properly?

HTA support in the boot image

Make sure that there is HTA support within the boot image.  I built our boot image using the MDT which by default has HTA support built in so this wasn’t a problem.  I tested this by PXE booting into the boot image and launching a small test HTA that I had on a USB thumb drive.  If you do a Google search there are other methods for finding this out like checking for the existence of the mshta executable.

Put HTA in a Software Distribution Package

I have a Software Distribution package that includes all of the VBScripts that I run during OSD deployments.  I simply added the HTA to this package and distributed it to the required distribution points.

Launch HTA during the WindowsPE phase

Launch OSD Options Wizard

Task sequence action

From within the Task Sequence I launch the HTA as the 1st step as a Run Command Line action.  Some guides on the web suggested that in the Command line section of the Task Sequence Editor, that you enter cscript.exe [name_of_hta] but I was never able to get the HTA to actually display.  So I simply entered the name of the HTA and this worked great for me.  Also, take note that this particular HTA is part of a package.

How do I set/get task sequence variables?

From within your HTA you’ll need the following lines within the VBScript block of the code.

Set TSEnv = CreateObject("Microsoft.SMS.TSEnvironment")

' To set a task sequence variable
TSEnv("foo") = value

' To get a task sequence variable
value = TSEnv("bar")

How do I hide the task sequence progress bar?

You’ll notice that the task sequence progress bar will display over your HTA, which isn’t cool at all.  So to remove it, add the following code within the VBScript code block of your HTA.

Set TSProgressUI = CreateObject("Microsoft.SMS.TsProgressUI")

Can you link a CSS stylesheet to the HTA?

The answer is Yes!  Which is great for designers-at-heart like myself.  I made sure that I included my CSS file within the software distribution package along with the HTA and other scripts.  Then just like in HTML, I added a <link> tag to the CSS in the <head> section of the HTA.

View the HTA in Action

I entitled the HTA the OSD Options Wizard.  Here’s a brief video of it in action.  Enjoy.