I have the following VBS script that runs at logon and removes a shared
printer on a server. This work great but if the user was to logon again the
script would error saying printer does not exist. Can anyone help with
script so that if it gets this error it would not display error ocde on
screen and just finish? New to VBS.....
VBS Script
' RemovePrinterConnection.vbs - Windows logon script
' VBScript to - Network Printer
' ------------------------------------------------------'
Option Explicit
Dim objNetwork, strUNCPrinter
strUNCPrinter = "\\servername\HPLaserJ1022NW"
Set objNetwork = CreateObject("WScript.Network")
' Section which removes the network printer
objNetwork.RemovePrinterConnection strUNCPrinter
'WScript.Echo "Check Printers folder NO: " & strUNCPrinter
Wscript.Quit
Error Code Display on screen if you have already run this cript and its
tries again
Line 1
Char 1
Error: This Network connection does not exist
Code: 800708CA
Source: wshNetwork.RemoveNetworkDrive
Thanks