LISTING 1: Script That Uses the Do Loop to Obtain a Valid Password Option Explicit Dim strUser, strDevice, strUncPath, strPassword Dim bUpdateProfile, bValidPassword Dim objNetwork Const LOGON_FAILURE = &h8007052E& ‘ BEGIN CALLOUT A strUser = "lab-sql-00\sa" ‘ END CALLOUT A strDevice = "s:" strUncPath = "\\lab-sql-00\dump$" bUpdateProfile = False bValidPassword = False Set objNetwork = CreateObject("WScript.Network") On Error Resume Next Do strPassword = InputBox("Enter SA password" & vbCrLf & _ "(click Cancel to exit the script)") If IsEmpty(strPassword) Then WScript.Quit objNetwork.MapNetworkDrive strDevice, strUncPath, _ bUpdateProfile, strUser, strPassword strPassword = vbEmpty Select Case Err.Number Case 0 bValidPassword = True Case LOGON_FAILURE bValidPassword = False Err.Clear WScript.Echo "Logon failure: Invalid password." & _ vbCrLf & "Please reenter password." & vbCrLf & _ "(Note: Password is case sensitive.)" Case Else WScript.Echo "0x" & CStr(Hex(Err.Number)) & _ ": " & Err.Description WScript.Quit End Select Loop While bValidPassword = False WScript.Echo "Success" BEGIN COMMENT ‘ The script would continue from here and run any code that you supply. END COMMENT