I am attempting to create an HTA that runs in the prestart context of a boot image. It has a prompt for computername, drop down for Operating System (task sequence), and a check box to run updates during OSD. However, when it runs, It still prompts me to pick a task sequence immediately following the HTA prompt. Can anyone point me in the right direction where my mistake is?
<html>
<head>
<title>Centered HTA</title>
<HTA:APPLICATION
ID="objHTA"
APPLICATIONNAME="OSD Computer Details"
SCROLL="no"
SINGLEINSTANCE="yes"
CAPTION="no"
showInTaskbar="no"
sysMenu="no"
contextMenu="no"
border="none"
borderStyle="sunken"
>
</head>
<SCRIPT Language="VBScript">
Sub Window_Onload
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor")
For Each objItem in colItems
intHorizontal = objItem.ScreenWidth
intVertical = objItem.ScreenHeight
Next
intLeft = (intHorizontal - 400) / 2
intTop = (intVertical - 300) / 2
window.resizeTo 400,300
window.moveTo intLeft, intTop
End Sub
'Hide the task sequence window
'On Error Resume Next
Dim oTaskSequence, oTSProgressUI
Set oTaskSequence = CreateObject ("Microsoft.SMS.TSEnvironment")
Set oTSProgressUI = CreateObject("Microsoft.SMS.TsProgressUI")
oTSProgressUI.CloseProgressDialog
Sub PreloadOptions
Dim sTSMachineName, bPromptName
sTSMachineName = ucase(oTaskSequence("_SMSTSMachineName"))
If left(sTSMachineName,6) = "MININT" Then
bPromptName = True
ElseIf sTSMachineName = "MINWINPC" Then
bPromptName = True
Else
bPromptName = False
End If
If bPromptName Then
ComputerName.value = ""
Else
ComputerName.value = sTSMachineName
End If
End Sub
Sub FinishClickTasks
'====================================
' Get/set computer name
'====================================
Dim sComputerName
sComputerName = UCase(ComputerName.Value)
' Check that a PC name was entered
Do
If sComputerName = "" Then
MsgBox "Error: Computer name cannot be left empty!", vbCritical, "Error"
sComputerName = InputBox ("Please enter a computer name to continue", "", , 30,30)
End If
Loop Until sComputerName <> ""
oTaskSequence ("OSDComputerName") = sComputerName
'====================================
' Get/set os configuration
'====================================
For Each oSelection in osChooser.Options
If oSelection.Selected Then
oTaskSequence ("SMSTSPreferredAdvertID") = ucase(oSelection.InnerText)
End If
Next
'====================================
' Get/set Updates
'====================================
If UpdateCheckbox.checked Then oTaskSequence ("OSDUpdates") = "true" End If
'====================================
' Terminate the HTA
'====================================
window.close
End Sub
</SCRIPT>
<body></body>
<body STYLE="font:12 pt arial; color:white; background-color:#0434b2" onload="PreloadOptions">
<div style="text-align:center">
<img style="width: 261px; height: 86px; border: 0;" src="logo.png">
</div>
<p>
<table align="center" cellpadding="3" border=1>
<tr valign=top>
<td align="center">
<p>
<b>Computer Name</b><br>
<input type=text id="ComputerName" name=ComputerName size=22>
</td>
<td align="center">
<p>
<b>OS Selection</b><br>
<select size="1" name="OSChooser">
<option value="SMS00026"> Windows 7 x86</option>
<option value="SMS00027"> Windows 8.1 x64</option>
<option value="SMS00054"> Windows 10 x64</option>
</select>
<p>
</td>
</tr>
</table>
<p>
<div style="text-align:center">
<input type="checkbox" name="UpdateCheckbox" checked="true"> Apply Updates During Build
</div>
<p>
<div style="text-align:center">
<button accesskey=N type=submit id=buttonFinish onclick=FinishClickTasks>Finish</button>
</div>
</html>
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.
I am attempting to create an HTA that runs in the prestart context of a boot image. It has a prompt for computername, drop down for Operating System (task sequence), and a check box to run updates during OSD. However, when it runs, It still prompts me to pick a task sequence immediately following the HTA prompt. Can anyone point me in the right direction where my mistake is?
Share this post
Link to post
Share on other sites