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");
alert(oEnvironment("UUID"));
}
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");
oEnvironment("DEPLOYMENTTYPE") = "NEWCOMPUTER";
The task sequence has a Group which checks for the value of that variable and if=NEWCOMPUTER It does some actions.
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")
oTSProgressUI.CloseProgressDialog()
env("ALLOWOSDBUILD") = "NO"
MyPass=Inputbox("Please enter the Password to start the OS Deployment")
If MyPass = "password" then
env("ALLOWOSDBUILD") = "YES"
End If
</script>
</job>
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.
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.
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.
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.
The task sequence has a Group which checks for the value of that variable and if=NEWCOMPUTER It does some actions.
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.
and below is a VBS example
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