----------------------------------------
An error has occured in the script on this page
Line: 898 (highlighted in Red below)
Char:2
Error: could not complete the operation due to error 80041002.
-----------------------------------------
At the start of my hta I have input boxes where the user is able to enter in the name of a computer. Which is where I get the strcomputername.value
Code: Select all
blnAnswer = window.confirm("Are you sure you want to continue? " & vbcrlf & vbcrlf & "Computer Name Will Become: " & vbcrlf & strComputerName.value)
Line :898 is in bold below which is where my hta stops and throws an error. Anyone have any ideas?
Code: Select all
Function JoinRETALDomain
Task4StatusRed.style.visibility="hidden"
Task4StatusProcessing.style.visibility="visible"
HTASleep(1)
Const JOIN_DOMAIN = 1
Const ACCT_CREATE = 2
Const ACCT_DELETE = 4
Const WIN9X_UPGRADE = 16
Const DOMAIN_JOIN_IF_JOINED = 32
Const JOIN_UNSECURE = 64
Const MACHINE_PASSWORD_PASSED = 128
Const DEFERRED_SPN_SET = 256
Const INSTALL_INVOCATION = 262144
Const wshOk = 6
Const wshYesNoDialog = 4
Const wshQuestionMark = 32
strDomain = "big.domainname.com"
strUser = "administrator"
strPassword = "bestpasswordever"
strOU = "OU=ThinClients,OU=Computers,DC=domain,DC=com"
Set objNetwork = CreateObject("WScript.Network")
strComputer = strComputerName.value
Set objComputer = GetObject("winmgmts:" _
& "{impersonationLevel=Impersonate,authenticationLevel=Pkt}!" & _
strComputer & "rootcimv2:Win32_ComputerSystem.Name='" & _
strComputer & "'")
ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, _
strPassword, strDomain & "" & strUser, strOU, _
JOIN_DOMAIN + ACCT_CREATE)
If ReturnValue = 0 Then
Message1 = objShell.Popup("Computer added to domain under old name without error. proceeding to change computer name. ")
Else
Message2 = objShell.Popup("Computer not added to domain successfully. Return value: " & ReturnValue)
End If
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!" & strComputer & "rootcimv2")
Set colComputers = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colComputers
Message3 = objShell.Popup("About to rename computer to: " & strComputer, 4, "Change Computer Name")
ErrCode = objComputer.Rename(strComputer, strPassword, strUser)
If ErrCode = 0 Then
Message4 = objShell.Popup("Computer renamed correctly.", 4)
Else
Message5 = objShell.Popup("Error changing computer name. Error code: " & ErrCode, 4)
End If
Next
HTASleep(1)
Task4StatusProcessing.style.visibility="hidden"
Task4StatusRed.style.visibility="hidden"
Task4StatusGreen.style.visibility="visible"
HTASleep(3)
UpdateFireWall
End Function