Question : VBScript login scripting - One Last Q

Hi,
I've written the following script to map network drives and printers for me.  I have been getting a "500 undefined variable error" when it tries to install the LAST PRINTER.  The printer actually still maps and installs perfectly fine, but I'd rather not confuse my co workers by letting them see an error.  I can always take out the error reporting and pretend like it isn't happening, but I'd like to see the errors if a legitimate error occurs.  Here's my script


Option Explicit
Dim strPath, strCommand, objShell
If LCase(Right(Wscript.FullName, 11)) = "wscript.exe" Then
    strPath = Wscript.ScriptFullName
    strCommand = "%comspec% /k cscript  """ & strPath & """"
    Set objShell = CreateObject("Wscript.Shell")
    objShell.Run(strCommand), 1, True
    Wscript.Quit
End If

Dim inUser, intDrive
Dim strRemotePath
Dim strShell
Dim objNetwork
Dim RemoveDrive
Dim bUpdateProfile, bForce

set objShell = CreateObject("WScript.Shell")
set objNetwork = CreateObject("WScript.Network")
objShell.PopUp "Welcome To the Rainbow Light Network Resource Utility v1.0, Please Read All Instructions."
objShell.PopUp "Please Enter Your First Name and Last initial with no space."
inUser = InputBox("Enter Your First Name and last initial, Do not Include a Space.  EXAMPLE  jamiej")
objShell.PopUp "Setting up Shared, Graphics and Home Drives"

 Dim arrDrive, strDrive, strShare, strDriveDetails
bUpdateProfile = "True"
bForce = "True"

strRemotePath = inUser& "$"
objShell.PopUp "Home Drive Path =" & strRemotePath

arrDrive = Array(_
      "S:~\\Ginkgo\shared",_
      "Z:~\\Rainbowserver\graphics",_
      "H:~\\Rainbowserver\" & strRemotePath)
On Error Resume Next
For Each strDriveDetails in arrDrive
      strDrive = Split(strDriveDetails, "~")(0)
      strShare = Split(strDriveDetails, "~")(1)
      
WScript.Echo strDrive & " Attempting to Remove Connection"
objNetwork.RemoveNetworkDrive strDrive, bForce, bUpdateProfile
If Err.Number <>0 Then
      WScript.Echo "Error Removing Drive " & strDrive & "-" & Err.Number & ":" & Err.Description
      Err.Clear
Else
      WScript.Echo strDrive &" Removed"
End If

WScript.Echo strDrive & " Attempting to Connect"
objNetwork.MapNetworkDrive strDrive, strShare, bUpdateProfile
If Err.Number <>0 Then
      WScript.Echo "Error Mapping " & strDrive & "- " & Err.Number &": "& Err.Description
      Err.Clear
Else
      WScript.Echo strDrive & " Mapped Succesfully" End If
Next
'Printer Install
      Dim strHPColor, strUltra, strStJohn, strPO
      Dim bColor, bPO
      Dim aColor, aPO
      strHPColor = "\\rainbowserver\HP Color LaserJet 5500 PCL 6"
      strUltra = "\\rainbowserver\Ultra Energy"
      strStJohn = "\\rainbowserver\StJohnsBliss"
      strPO = "\\rainbowserver\PO"
      
      'Question Set UP
      bColor = False
      bPO = False
      aColor = InputBox ("Do You Require Color Printing, please type Yes or No")
      If aColor = "yes" then
            bColor= True
      Else
            bColor = False
      End If
      aPO = InputBox ("Do You Require The PO Printer? Please Type Yes Or No")
      If aPO = "yes" then
            bPO = True
      Else
            bPO = False
      End If
'Printer Install
      WScript.Echo "Now Installing Printers"
      If bColor = True Then
            WScript.Echo "HP Color 5500Dn - Now Attempting To Install"
            objNetwork.AddWindowsPrinterConnection(strHPColor)
            If Err.Number <>0 Then
                  WScript.Echo "Error Mapping Color Printer " & Err.Number & ":" & Err.Description & "Please Ignore undefined Errors"
                  Err.Clear
            Else
                  WScript.Echo "Hp Color LaserJet 5500Dn Succesfully Installed"
            End IF      
      End IF
      If bPO = True then
            WScript.Echo "Now Attempting to Install PO Printer"
            objNetwork.AddWindowsPrinterConnection(strPO)
            If Err.Number<>0 then
                  WScript.Echo "Error Mapping PO Printer" & Err.Number & ":" & Err.Description
                  Err.Clear
            Else
                  WScript.Echo "PO Printer installed"
            End If
      Else
      End If
      WScript.Echo "Now Installing Ultra Energy"
      objNetwork.AddWindowsPrinterConnection(strUltra)
            If Err.Number <>0 Then
                  WScript.Echo "Error Mapping Printer" & Err.Number & ":" & Err.Descritption
                  Err.Clear
            Else
                  WScript.Echo "Ultra Energy Succesfully Installed"
            End If
      WScrip.Echo "Now Attempting to Install St.Johns Bliss"
      objNetwork.AddWindowsPrinterConnection(strStJohn)
      If Err.Number <>0 Then
            WScript.Echo "Error Mapping St.Johns Bliss " & Err.Number & ":" & Err.Description &_
            " **PLEASE IGNORE** '500: Undefined Variable' Errors"
            Err.Clear
      Else
            WScript.Echo "St. Johns Bliss Installed!"
      End If
objShell.PopUP "Finished, Thank You for Running"
WScript.Quit

Answer : VBScript login scripting - One Last Q

If this is indeed a copy and paste of the actual script, have a close look at the line before you're trying to map the last printer; it says "WScrip.echo" (not "WScrip*t*.echo"):
      WScrip.Echo "Now Attempting to Install St.Johns Bliss"
Random Solutions  
 
programming4us programming4us