I have a vbscript to join a domain. The issue is I have no error checking to see if correct user name/password was user. As of right now, any user name/password will "join" the domain but in actually, you aren't because a bad user name and/or password were user. I have a input box where you enter your user name and password, that info is passed on to the following vbscript and then "joins" the domain. I am looking for a way to error check it so if a wrong user name/password is entered, it runs the input box again (the input box is "JoinDomain.exe"). The only think I came up with was to try to map a network drive as my error checker. If a wrong user name/password is supplied, you receive an error. The issue is, it stops there. I heed help to make to loop back to the JoinDomain.exe or if someone has any other way to error check, that would be great. vbscript posted below:
Code:
Option Explicit
Dim objShell, WshShell
Dim ReturnValue
Dim RestartMsg
Dim Network
Dim u_name, p_word
Dim dtStart
Dim strUser, strPassword, strDomain, strComputer, strDriveLetter, strRemotePath, strProfile
Dim objNetwork, objComputer, objWMIService, objConnection, objCommand, objRecordSet
Dim objOperatingSystem, colOperatingSystems
Set objShell = CreateObject("Shell.Application")
Set WshShell = CreateObject("WScript.Shell")
Set objShell = CreateObject("Wscript.Shell")
Set WshShell = WScript.CreateObject("WScript.Shell")

'=== Join Domain ===
strUser = WScript.Arguments(0)
strPassword = WScript.Arguments(1)
strDomain = "bud.bpa.gov"

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

'=== Start Account Check ===
Set network = Wscript.CreateObject("WScript.Network") 
strDriveLetter = "Z:" 
strRemotePath = "\\bud.bpa.gov\ent"
strProfile = "false"

Set objNetwork = WScript.CreateObject("WScript.Network") 
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath, strProfile, "BUD\" & strUser, strPassword

On Error Resume Next
'NEED HELP HERE!!! 

'=== End Account Check ===

'Set objNetwork = CreateObject("WScript.Network")
'strComputer = objNetwork.ComputerName
'Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _
'   strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & strComputer & "'")
'ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, _
'   strPassword, strDomain & "\" & strUser, NULL, JOIN_DOMAIN + ACCT_CREATE)

'==== Restart Computer ====
'RestartMsg=MsgBox("Welcome to the BUD Domain." & Chr(13) & _
'		  ""  & Chr(13) & _
'                  "Click OK to restart your computer to finish the uDisc installation process.", _
'                  0, "Restart") 
'strComputer = "."
'Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate,(Shutdown)}!\\" _
'    & strComputer & "\root\cimv2")
'Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
'For Each objOperatingSystem in colOperatingSystems
'    ObjOperatingSystem.Reboot()
'Next