Avatar of Samad Abdul
Samad Abdul

asked on 

VBS script error 1332

Hello,
I have this vbs script that's suppose to join the windows 7 to domain image at first boot. It's able to rename but at join domain part it fails and comes back with Join domain Failed. Error = 1332 Exiting script. Prior to syspreping the image, this script words perfectly fine but after sysprep it runs at first logon under SetupComplete.CMD in C:\windows\setup\scripts\setupcomplete.cmd I tell this cmd to run start c:\windows\setup\scripts\joindomain.vbs

Const JOIN_DOMAIN = 1
Const ACCT_CREATE = 2

Dim sCmpName
Dim sUser, sPassword, sDomain, sOU

sUser = "test"
sPassword = "test"
sDomain = "test"

sCmpName = InputBox("Enter the new computer name:", "Computer Name")
If sCmpName = "" Then
Wscript.Echo "Exiting script."
Wscript.Quit
End If

Dim oWMI, oCmp, oOS, sReturn

Set oWMI = GetObject("winmgmts:\\.\root\cimv2")
For Each oCmp in oWMI.InstancesOf("Win32_ComputerSystem")
sReturn = oCmp.Rename(sCmpName)
If sReturn <> 0 Then
Wscript.Echo "Rename failed. Error = " & sReturn & _
vbcrlf & "Exiting script."
Else
Wscript.Echo "Rename successful."
sReturn = oCmp.JoinDomainOrWorkgroup(sDomain, sPassword, _
sDomain & "\" & sUser, sOU, JOIN_DOMAIN)
If sReturn <> 0 Then
Wscript.Echo "Join domain failed. Error = " & sReturn & _
vbcrlf & "Exiting script."
Else
Wscript.Echo "Join domain successful."
End If
Wscript.Echo "Rebooting computer..."
Dim oShell

Set oShell = CreateObject("Wscript.Shell")
sReturn = oShell.Run("%comspec% /c shutdown -r -t 0 -f")

Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile WScript.ScriptFullName
Set objFSO = Nothing

End If
Next
Windows 7VB Script

Avatar of undefined
Last Comment
Mike
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Please post content of this file
C:\Windows\Debug\NetSetup.log

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Samad Abdul
Samad Abdul

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Mike
Mike
Flag of United States of America image

No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Accept: Samad Abdul (https:#a42068789)

If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

FireRunt
Experts-Exchange Cleanup Volunteer
Windows 7
Windows 7

Windows 7 is an operating system from Microsoft. Features include multi-touch support, a redesigned Windows Shell with a new taskbar, referred to as the Superbar, a home networking system called HomeGroup, and performance improvements.

48K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo