Creating the ultimate SCCM 2007 Frontend HTA for OSD Part IV
Now it's time to setup our task sequence to use the variables we just set with the HTA
First we need to launch the HTA, I have it setup so you can make it launch in French to start but we haven't implemented that in this example. We'll use a simple launch script to kick things off. If we wanted to start in French we would add fra at the command line.
------------------------------------
dim cmdline
set sh = CreateObject("Wscript.Shell")
If Wscript.Arguments.Count = 0 Then
call sh.Run("UHTA.hta", 1, True)
Else
If Wscript.Arguments(0) = "fra" Then
call sh.Run("UHTA.hta ""fra""", 1, True)
End If
End If
-------------------------------------

Now Apply the OS, we will use the xml file we created earlier. The %lang-file% was set in the HTA so it will be either fra.xml or eng.xml skipping the language prompt.

There is nothing special about the apply windows settings step, but apply network settings does use a HTA Variable.

Next we use the toolkit package, all it really does is copy the scripts I'll skip the screen shot...just pick the package.
Next we Gather, this is where the rules.ini we created is used.

Next the configure step, it's really a run command line but it's important it's what actually applies the changes.

Ok, then the drivers get installed. That will depend on your hardware...duh. Once config manager is done setting up...several minutes later. We get to the domain join. The apply network settings actually created the AD object but this is the first time the computer is actually booting fully into windows so now the OS must join the domain. The delay between creation and join is good because it allows for replication to BDC's. We use our %LDAP% variable here again. I have a restart next because I'm supressing the domain join reboot. We didn't actually supress it in the Ultimate HTA example.

Once we restart we are now able to authenticate to the domain and update the AD description. The service account that created the object will be able to update it's description. We fall back to VBScript to do this. I first thought powershell might be better for this but it's not. I have this file saved as AD2.vbs in my HTA package.
----------------------------------
'This script populates the AD description for the computer that runs it. Takes the value from the command line
'If nothing is passed it will fill with default make , model and serial number.
If Wscript.Arguments.Count = 0 Then
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
' get service tag and computer manufacturer
For Each objSMBIOS in objWMI.ExecQuery("Select * from Win32_SystemEnclosure")
serviceTag = replace(objSMBIOS.SerialNumber, ",", ".")
manufacturer = replace(objSMBIOS.Manufacturer, ",", ".")
Next
' get computer model
For Each objComputer in objWMI.ExecQuery("Select * from Win32_ComputerSystem")
model = trim(replace(objComputer.Model, ",", "."))
Next
description = manufacturer & " " & model
else
description = Wscript.Arguments(0)
end if
' get computer object in AD
Set objSysInfo = CreateObject("ADSystemInfo")
Set objComputer = GetObject("LDAP://" & objSysInfo.ComputerName)
' save into computer object
objComputer.Description = description
objComputer.SetInfo
--------------------------------------------------------
.png)
Finally we you the options to install updates or not based on the checkbox and variable from the HTA in the beginning.
