madison2008
IS-IT--Management
I am trying to delete a selected network printers for our users but in the real world, some user may only have 1 or of the 3 printers I needed to delete installed. For example if the user only has canon2 and canon3 installed, the script errors out because it does not detect canon1 and the script will terminate. I wanted it so it continues to deleted the other canons even if 1 or two of the 3 are missing. Here is the script. I appreciate your help.
Set WshNetwork = WScript.CreateObject("WScript.Network")
WshNetwork.RemovePrinterConnection "\\sny-apps\canon1"
WshNetwork.RemovePrinterConnection "\\sny-apps\canon2"
WshNetwork.RemovePrinterConnection "\\sny-apps\canon3"
Set WshNetwork = WScript.CreateObject("WScript.Network")
WshNetwork.RemovePrinterConnection "\\sny-apps\canon1"
WshNetwork.RemovePrinterConnection "\\sny-apps\canon2"
WshNetwork.RemovePrinterConnection "\\sny-apps\canon3"