The following custom HTA can be used during OSD when imaging computers with SCCM 2007. It has been updated from my previous version and will do the following:
- Section 1 – for the name to be give to the computer.
- Section 2 – for the technician imaging the computer
- Section 3 – for a ticket number
- Section 4 – for adding a user to the local admins group
- Section 5 – for selecting the computer’s time zone
Note: additional time zones can be found at http://technet.microsoft.com/en-us/library/cc749073(WS.10).aspx - Section 6 – for selecting a flavor of Acrobat as post installed software
- Section 7 – for selecting other software to be installed
- Note that on the first three sections, if the option is left empty, then after clicking finish a circular prompt is done until a value is added. Also, they set custom Task Sequence variables which you will need to use later in your process, such as in custom logging or setting a registry key for your organization, etc.
Also, remember to enable HTA support in your boot images – http://t3chn1ck.wordpress.com/2010/01/28/hta-support-in-sccm-boot-images/
<!-- -----------------------------------------------------------
Created by Nick Moseley http://t3chn1ck.wordpress.com
For this script to function, HTA support must have been added into the boot image
See for more information - http://technet.microsoft.com/en-us/library/dd799244.aspx
--------------------------------------------------------------- -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>OSD Options Chooser</title>
<HTA:APPLICATION APPLICATIONNAME="OSD Options Chooser" SCROLL="yes" SINGLEINSTANCE="yes" WINDOWSTATE="normal" BORDER="thin">
<script language="vbscript" type="text/vbscript">
window.resizeTo 375,700
window.moveTo 5,5
Sub FinishClickTasks
'On Error Resume Next
Dim oTaskSequence, oShell, sComputerName, bErrComputerName, bErrTechName, bErrTicketNumber, sCurPath, sKioskName
Set oTaskSequence = CreateObject ("Microsoft.SMS.TSEnvironment")
Set oShell = CreateObject ("WScript.Shell")
sComputerName = UCase(ComputerName.Value)
' Set values inputed from HTA dialog
If sComputerName = "" Then
oTaskSequence ("OSDComputerName") = "null"
Else
oTaskSequence ("OSDComputerName") = sComputerName
End If
If TechName.Value = "" Then
oTaskSequence ("OSDTechName") = "null"
Else
oTaskSequence ("OSDTechName") = TechName.Value
End If
If TicketNumber.Value = "" Then
oTaskSequence ("OSDTicketNumber") = "null"
Else
oTaskSequence ("OSDTicketNumber") = TicketNumber.Value
End If
' Check for errors with the computer name or technician name
Dim sTSVar1, sTSVar2, sTSVar3, bNoErr
sTSVar1 = oTaskSequence("OSDComputerName")
sTSVar2 = oTaskSequence("OSDTechName")
sTSVar3 = oTaskSequence("OSDTicketNumber")
bNoErr = False
If sTSVar1 = "null" Then
bErrComputerName = True
End If
If sTSVar2 = "null" Then
bErrTechName = True
End If
If sTSVar3 = "null" Then
bErrTicketNumber = True
End If
' Display error message
If bErrComputerName And bErrTechName And bErrTicketNumber Then
MsgBox "Error: Computer name, technician name, and Incident or Service Request number cannot be blank.", vbCritical, "Error"
ElseIf bErrComputerName And bErrTechName Then
MsgBox "Error: Computer name and technician name cannot be blank.", vbCritical, "Error"
ElseIf bErrComputerName And bErrTicketNumber Then
MsgBox "Error: Computer name and Incident or Service Request number cannot be blank.", vbCritical, "Error"
ElseIf bErrTechName And bErrTicketNumber Then
MsgBox "Error: Technician name and Incident or Service Request number cannot be blank.", vbCritical, "Error"
ElseIf bErrComputerName Then
MsgBox "Error: Computer name cannot be blank.", vbCritical, "Error"
ElseIf bErrTechName Then
MsgBox "Error: Technician name cannot be blank.", vbCritical, "Error"
ElseIf bErrTicketNumber Then
MsgBox "Error: Incident or Service Request number cannot be blank.", vbCritical, "Error"
End If
' Loop until end-user enters a value
Do
If bErrComputerName Then
sComputerName = InputBox ("Please enter a COMPUTER name to continue", "", , 30,30)
If sComputerName <> "" Then
oTaskSequence ("OSDComputerName") = sComputerName
bErrComputerName = False
End If
ElseIf bErrTechName Then
sTechName = InputBox ("Please enter a TECHNICIAN name to continue.", "", , 30,30)
If sTechName <> "" Then
oTaskSequence ("OSDTechName") = sTechName
bErrTechName = False
End If
ElseIf bErrTicketNumber Then
sTicketNumber = InputBox ("Please enter an Incident or Service Request number to continue.", "", , 30,30)
If sTicketNumber <> "" Then
oTaskSequence ("OSDTicketNumber") = sTicketNumber
bErrTicketNumber = False
End If
Else
bNoErr = True
End If
Loop Until bNoErr
' Set local time zone
For Each oTimeZone In TimeZone
If oTimeZone.Checked Then
oTaskSequence("OSDTimeZone") = oTimeZone.value
End If
Next
' UserName to add as a local administrator
If UserName.Value <> "" Then
oTaskSequence ("OSDAdminUser") = UserName.Value
End If
' Applications to install
' Acrobat
If Acrobat(1).checked Then
oTaskSequence ("OSDAcrobat10") = "standard"
ElseIf Acrobat(2).checked Then
oTaskSequence ("OSDAcrobat10") = "professional"
End If
' Other Apps
If ProjectStd2010.checked Then
oTaskSequence ("OSDProjStd2010") = "true"
End If
If VisioStd2010.checked Then
oTaskSequence ("OSDVisioStd2010") = "true"
End If
If StreetsTrips2010.checked Then
oTaskSequence ("OSDStreetsTrips2010") = "true"
End If
window.close
End Sub
</script>
</head>
<body>
<!-- HTML goes here -->
<body STYLE="font:10 pt arial; color:white; background-color: #336600">
<p>Computer Name<BR>
<input type=text id="ComputerName" name=ComputerName size=45></p>
<p>Technician Name Imaging Computer<BR>
<input type=text id="TechName" name=TechName size=45></p>
<p>Incident or Request Number<BR>
<input type=text id="TicketNumber" name=TicketNumber size=45></p>
<p>Username to add to Local Admin Group (if applicable)<BR>
<input type=text id="UserName" name=UserName size=45></p>
<p><b>Select Time Zone For the Computer</b><br>
<input type="radio" name="TimeZone" value="Pacific Standard Time">PST (US West Coast)<BR>
<input type="radio" name="TimeZone" value="US Mountain Standard Time">AZT (US Arizona)<br>
<input type="radio" name="TimeZone" value="Mountain Standard Time" checked="True">MST (US Mountain)<BR>
<input type="radio" name="TimeZone" value="Central Standard Time">CST (US Central)<BR>
<input type="radio" name="TimeZone" value="Eastern Standard Time">EST (US East Coast)<BR>
<p><b>Select Post Installed Applications</b><br>
<input type="radio" name="Acrobat" checked="True"> Do not install Acrobat<br>
<input type="radio" name="Acrobat"> Adobe Acrobat Standard X<br>
<input type="radio" name="Acrobat"> Adobe Acrobat Professional X<br>
<br>
<input type="checkbox" name="ProjectStd2010"> Microsoft Project Standard 2010<br>
<input type="checkbox" name="StreetsTrips2010"> Microsoft Streets and Trips 2010<br>
<input type="checkbox" name="VisioStd2010"> Microsoft Visio Standard 2010<br>
<p><button accesskey=N type=submit id=buttonFinish onclick=FinishClickTasks>Finish</button>
<br>Created by Nick Moseley, http://t3chn1ck.wordpress.com</font>
</body>
</html>



#1 by IT.Never.Ends... on April 2, 2012 - 6:54 am
Hey,
This is wonderful, thanks a lot,
i’ve changed it a bit if you’re interested in my version which let’s the user choose between OS refresh, bare metal and a confirmation before formatting (if bare metal is chosen), a placeholder for company logo and cancel button,
https://docs.google.com/document/pub?id=1Uq3SwHMKS9Betsyn1X6F_0PvXu7t2TFBjv56aGsx3No
#2 by Nicolas Moseley on April 2, 2012 - 10:36 pm
Thanks! By the way, I like your gravatar name!!