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:APPLICATIONID="objHTA"APPLICATIONNAME="OSD Computer Details"SCROLL="no"SINGLEINSTANCE="yes"CAPTION="no"showInTaskbar="no"sysMenu="no"contextMenu="no"border="none"borderStyle="sunken"></head><SCRIPTLanguage="VBScript">SubWindow_Onload
strComputer ="."Set objWMIService =GetObject("winmgmts:\\"& strComputer &"\root\cimv2")Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor")ForEach objItem in colItems
intHorizontal = objItem.ScreenWidth
intVertical = objItem.ScreenHeightNext
intLeft =(intHorizontal -400)/2
intTop =(intVertical -300)/2
window.resizeTo 400,300
window.moveTo intLeft, intTop
EndSub'Hide the task sequence window
'OnErrorResumeNextDim oTaskSequence, oTSProgressUI
Set oTaskSequence =CreateObject("Microsoft.SMS.TSEnvironment")Set oTSProgressUI =CreateObject("Microsoft.SMS.TsProgressUI")
oTSProgressUI.CloseProgressDialogSubPreloadOptionsDim sTSMachineName, bPromptName
sTSMachineName = ucase(oTaskSequence("_SMSTSMachineName"))If left(sTSMachineName,6)="MININT"Then
bPromptName =TrueElseIf sTSMachineName ="MINWINPC"Then
bPromptName =TrueElse
bPromptName =FalseEndIfIf bPromptName ThenComputerName.value =""ElseComputerName.value = sTSMachineName
EndIfEndSubSubFinishClickTasks'===================================='Get/set computer name
'====================================Dim sComputerName
sComputerName =UCase(ComputerName.Value)'Check that a PC name was entered
DoIf sComputerName =""ThenMsgBox"Error: Computer name cannot be left empty!", vbCritical,"Error"
sComputerName =InputBox("Please enter a computer name to continue","",,30,30)EndIfLoopUntil sComputerName <>""
oTaskSequence ("OSDComputerName")= sComputerName
'===================================='Get/set os configuration
'====================================ForEach oSelection in osChooser.OptionsIf oSelection.SelectedThen
oTaskSequence ("SMSTSPreferredAdvertID")= ucase(oSelection.InnerText)EndIfNext'===================================='Get/setUpdates'====================================IfUpdateCheckbox.checked Then oTaskSequence ("OSDUpdates")="true"EndIf'===================================='Terminate the HTA
'====================================
window.close
EndSub</SCRIPT><body></body><bodySTYLE="font:12 pt arial;color:white;background-color:#0434b2"onload="PreloadOptions"><divstyle="text-align:center"><imgstyle="width:261px;height:86px;border:0;"src="logo.png"></div><p><tablealign="center"cellpadding="3"border=1><trvalign=top><tdalign="center"><p><b>Computer Name</b><br><inputtype=textid="ComputerName"name=ComputerNamesize=22></td><tdalign="center"><p><b>OS Selection</b><br><selectsize="1"name="OSChooser"><optionvalue="SMS00026"> Windows 7 x86</option><optionvalue="SMS00027"> Windows 8.1 x64</option><optionvalue="SMS00054"> Windows 10 x64</option></select><p></td></tr></table><p><divstyle="text-align:center"><inputtype="checkbox"name="UpdateCheckbox"checked="true"> Apply Updates During Build
</div><p><divstyle="text-align:center"><buttonaccesskey=Ntype=submitid=buttonFinishonclick=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