I have a simple vbscript to change computer name during the OS deployment:
On Error Resume Next
Dim objWMIService
Dim colItems
Dim colBattery
Dim objSMSEnv
Dim strNewName
Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Bios")
Set colBattery = objWMIService.ExecQuery("SELECT * FROM Win32_Battery")
'Promt for Site Code
strSite = InputBox("Enter the Site Code:")
' Get the Serial Number
For Each objItem In colItems
' Remove all beginning, trailing and containing spaces and change to all upper case
strNewName = UCase(Trim(Replace(objItem.SerialNumber, " ", "")))
Next
strNewName = Right(strNewName, 5)
'Site Code + Last 5 of Serial Number
strNewName = strSite & strNewName
' Set the Environment Variable that controls the Computer Name
Set objSMSEnv = CreateObject("Microsoft.SMS.TSEnvironment")
objSMSEnv("OSDCOMPUTERNAME") = strNewName
I would like to convert this into HTA. This would be first one for me. I need some help converting and how would i run an HTA?
Thanks for the help.