Jump to content

  • 0

How can I pass values from the HTA to the Task Sequence


You can use your FrontEnd HTA to set values (variables) which in turn can be used (or checked for) in your Task Sequence. The FrontEnd can display options to your users like drop down menus or Radio Buttons, which have corresponding backend scripts which set values.

In addition, values can be gathered using the MDT ztigather.wsf script, this queries wmi and pulls a whole load of values which in turn are processed by ZTIUtility.vbs,

For example, the UUID value of a client is gathered (read) by ZTIgather.wsf, and ZTIutility.vbs sets this value oEnvironment.Item("UUID").

We can create a function in our HTA FrontEnd backend javascript script, to show the value of UUID.

function showUUID()
var oEnvironment = new ActiveXObject("Microsoft.SMS.TSEnvironment");

The script above will only work if a Gather step has taken place beforehand.

When ZtiGather.wsf runs, it produces a log file (ztigather.log) and in that log file you can see what it has detected, anything that is marked as Property can be ‘used’ or displayed in our HTA,


Javascript (*.js) backend sample

The below script will set a variable called DEPLOYMENTTYPE. It sets it to a value which in turn we'll check for in our task sequence.

var oEnvironment = new ActiveXObject("Microsoft.SMS.TSEnvironment");

The task sequence has a Group which checks for the value of that variable and if=NEWCOMPUTER It does some actions.

deploymenttype equals newcomputer.jpg

windows Scripting File (*.wsf) backend sample

The below sample code sets a variable called ALLOWOSDBUILD, which is checked for in the task sequence, if the value=NO then the task sequence shutsdown the computer.

<job id="PromptForPassword">
<script language="VBScript" >
Dim env,oTSProgressUI,MyPass
Set env = CreateObject("Microsoft.SMS.TSEnvironment")
set oTSProgressUI = CreateObject("Microsoft.SMS.TSProgressUI")
MyPass=Inputbox("Please enter the Password to start the OS Deployment")
If MyPass = "password" then
End If

wsf sample.jpg


and below is a VBS example

set env = CreateObject ("Microsoft.SMS.TSEnvironment")
strTask = env("_SMSTSPackageName")

' log file to be used
strFile = "\\server\log$\" & strTask & ".txt"

the above writes out the Task Sequence name as the 'name' of the log file.

Share this post

Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.