SoftwareCentral · SoftwareCentral HTA

Setup HTA Script

The script HTA_Dynamic.hta is created when you save or download the HTA in Design HTA. This page shows the few settings in it that you may change: the SoftwareCentral address, how the computer is identified, and an optional function for custom computer names.

Site address MAC address or SMBIOS GUID Computer name function

1 Before you start

The script is the file created in the Design HTA chapter, and it is called HTA_Dynamic.hta. All changes to the script can be made in any text editor.

The address is mandatory. The other steps are optional settings, so that the HTA fits the needs it was created for.

Edit after the last download Each time you save or download the HTA in Design HTA, SoftwareCentral writes a new copy of the script from its template and fills in the settings of the design. Make your changes after the last download, or they are lost.

2 The address

The script has one address line, swcAddress. SoftwareCentral fills it in with the address of your SoftwareCentral site when it writes the script. A slash at the end of the address is removed by the script.

If the HTA uses Anonymous authentication, SoftwareCentral writes the placeholder http://SoftwareCentralAddressAnonymous instead. Change the placeholder to the address of the anonymous website that you created in Setup Website.

Text editor showing an earlier HTA script with a comment line, the line swcAddress set to http://SoftwareCentralAddress, and a second line swcAddressAnonymous set to http://SoftwareCentralAddressAnonymous.
Text editor, an earlier version of the script (an earlier setup). That version had two address lines, swcAddress and swcAddressAnonymous. The current script has only swcAddress, and the anonymous placeholder is written into it for Anonymous authentication.

3 MAC address or SMBIOS GUID

The script identifies the computer by its MAC address, its SMBIOS GUID, or both. The design decides which. When SoftwareCentral writes the script, it sets the two switches below to match the elements in the design.

Switch in the scriptSet to true when the design has
UseMacAddressThe MAC Address element.
UseSMBIOSGUIDThe MSBIOS GUID element.

To identify computers by MAC address only, use UseMacAddress = true and UseSMBIOSGUID = false. For SMBIOS GUID only, use the opposite. For both, set both to true. If you change a switch by hand, it must match the design.

At least one is required A design needs the MAC address or the SMBIOS GUID element, or the HTA cannot be saved. See Design HTA.

The SMBIOS GUID lookup is always in the script. It only runs when UseSMBIOSGUID is true, so you do not need to uncomment any lines.

Text editor showing an earlier HTA script with the SMBIOS GUID lookup lines, the Win32_ComputerSystemProduct query and the UUID assignment, all shown as comments.
Text editor, an earlier version of the script (an earlier setup). The SMBIOS GUID lookup was written as comment lines and had to be uncommented. In the current script the lookup is in the file and runs when UseSMBIOSGUID is true.
Text editor showing an earlier HTA script with the WaitAndClose function, its comment about changing MacAddress to SMBIOSGUID, and the CloseWindowIfReady call.
Text editor, an earlier version of the script (an earlier setup). That version had a WaitAndClose function, which called CloseWindowIfReady with MacAddress. The current script has no WaitAndClose function, so this step does not apply to it.

4 Computer name

If your naming convention is not supported by the automatic computer naming of SoftwareCentral, the script can get the computer name from your own code. Add the code in the GetComputerName function.

The function only has an effect on unknown computers. The function in the current script looks like this:

Function GetComputerName(macAddress)
'Insert your logic to get the computer name here:
'Dim YourName
'...
'...
'YourName = ...
'Return computer name:
'GetComputerName = YourName
End Function
Text editor showing the GetComputerName function with the comments that say where to insert the logic to get the computer name.
Text editor showing the GetComputerName function (from an earlier setup). Insert your logic where the comments say, and return the name by assigning it to GetComputerName.

5 Best practice

  • Use the anonymous website's address for the placeholder when the HTA uses Anonymous authentication. SoftwareCentral only writes the placeholder; it does not know your anonymous address, so you must change it.
  • Make your edits after the last save or download. Each save or download writes a new copy of the script from the template.
  • Keep the switches in the script the same as the design. The design needs the MAC address or the SMBIOS GUID element.
  • Use the computer name function only for your own naming rule. It only has an effect on unknown computers.
  • Copy the changed script to the boot image share, and distribute the boot image again. See Setup Windows PE.

6 Troubleshooting

SymptomCauseWhat to do
"Failed to create dynamic HTA script." (in the SoftwareCentral log, not on the screen)SoftwareCentral could not copy the template to Uploads\HTA\HTA_Dynamic.hta when you saved or downloaded the HTA, so the file does not match the design.Read the log entry for the details. Make sure the SoftwareCentral web site can write to its Uploads\HTA folder, then save or download the HTA again.
The HTA does not reach SoftwareCentral, and the script still contains http://SoftwareCentralAddressAnonymousThe placeholder for Anonymous authentication was not changed.Change it to the address of the anonymous website from Setup Website.
Your changes to HTA_Dynamic.hta have disappearedSaving or downloading the HTA in Design HTA wrote a new copy of the script from the template.Make the changes again after the last download.