I'm trying to get a script to delete all printers from a certain printer server (cal1) and add the printers I want with the default setting. however on some machines only one eng5si printer might exist. when i run the script it gives me an error that one eng5si connections doesn't exit, this is usually the first occurence (Thus is doesn't delete all the eng5si printers currently installed on the computer) Can any tell me how to write an if statement or some line that will bypass non existing printer connections and delete the rest of the eng5si on cal1.
this is the code
--------------------------------------------------------
Set objNetwork = WScript.CreateObject("WScript.Network"
objNetwork.RemovePrinterConnection "\\cal1\Eng5si1"
objNetwork.RemovePrinterConnection "\\cal1\Eng5si2"
objNetwork.RemovePrinterConnection "\\cal1\Eng5si3"
objNetwork.AddWindowsPrinterConnection "\\voyager\adminhp"
objNetwork.AddWindowsPrinterConnection "\\voyager\cgyadmin"
objNetwork.AddWindowsPrinterConnection "\\voyager\cgyadminDBS"
objNetwork.SetDefaultPrinter("\\voyager\adminhp"
this is the code
--------------------------------------------------------
Set objNetwork = WScript.CreateObject("WScript.Network"
objNetwork.RemovePrinterConnection "\\cal1\Eng5si1"
objNetwork.RemovePrinterConnection "\\cal1\Eng5si2"
objNetwork.RemovePrinterConnection "\\cal1\Eng5si3"
objNetwork.AddWindowsPrinterConnection "\\voyager\adminhp"
objNetwork.AddWindowsPrinterConnection "\\voyager\cgyadmin"
objNetwork.AddWindowsPrinterConnection "\\voyager\cgyadminDBS"
objNetwork.SetDefaultPrinter("\\voyager\adminhp"