Properly Mapping Printers through Logon Script? - TechRepublic
Question
November 4, 2009 at 08:07 AM
csmeraglinolo

Properly Mapping Printers through Logon Script?

by csmeraglinolo . Updated 16 years, 8 months ago

Hi all,

Due to the way the physical layout of our building is combined with the hardware on hand, I am forced to share printers from workstations. I realize this is not optimal and network printers installed on a print server would be the correct way to do things…

This is my current *ugly* logon vbs script:

Set wshNetwork = CreateObject(“WScript.Network”)
PrinterPath = “\\TB-003\HPLaserJ”
WshNetwork.AddwindowsPrinterConnection PrinterPath, PrinterDriver

Set wshNetwork = CreateObject(“WScript.Network”)
PrinterPath = “\\TBLAZE1\ReadingRoomLaser”
WshNetwork.AddwindowsPrinterConnection PrinterPath, PrinterDriver

Set wshNetwork = CreateObject(“WScript.Network”)
PrinterPath = “\\jansson3\JanssonLaser”
WshNetwork.AddwindowsPrinterConnection PrinterPath, PrinterDriver

Set wshNetwork = CreateObject(“WScript.Network”)
PrinterPath = “\\server2\OceCopier”
WshNetwork.AddwindowsPrinterConnection PrinterPath, PrinterDriver

Set wshNetwork = CreateObject(“WScript.Network”)
PrinterPath = “\\TBLAZE12\GreavesL”
WshNetwork.AddwindowsPrinterConnection PrinterPath, PrinterDriver

Set wshNetwork = CreateObject(“WScript.Network”)
PrinterPath = “\\MONTE4\LJ2420-Monte”
WshNetwork.AddwindowsPrinterConnection PrinterPath, PrinterDriver

My question is how can I catch errors when a printer will not map (due to the machine being turned off, etc), but continue the script? Currently if one printer is unavailable, the script fails and none of the printers are mapped.

Thanks in advance!
Chris

This discussion is locked

All Comments