PDA

View Full Version : Adding Printers (All)



khorton44
06-13-2002, 09:16 PM
I recently created the script below to map multiple printers but only the first printer on the list is being mapped. What am I missing here? Thanks in advance for help.

Set WshNetwork = CreateObject("WScript.Network")

WshNetwork.AddWindowsPrinterConnection "\\SitePrntSrv\2138rcps"
WshNetwork.AddWindowsPrinterConnection "\\SitePrntSrv\hp_4050"
WshNetwork.AddWindowsPrinterConnection "\\SitePrntSrv\Hp2100_A"
WshNetwork.AddWindowsPrinterConnection "\\SitePrntSrv\Hp2100_B"
WshNetwork.AddWindowsPrinterConnection "\\SitePrntSrv\Hp2100_C"
WshNetwork.AddWindowsPrinterConnection "\\SitePrntSrv\hp 4100"
WshNetwork.AddWindowsPrinterConnection "\\SitePrntSrv\tek 360"

ywhw
06-26-2002, 02:35 AM
I am not sure this will work, but give it a try:

'setup array
dim i 'counter
dim printer_array(7) 'array variable
printer_array(0) = "\\SitePrntSrv\2138rcps"
printer_array(1) = "\\SitePrntSrv\hp_4050"
printer_array(2) = "\\SitePrntSrv\Hp2100_A"
printer_array(3) = "\\SitePrntSrv\Hp2100_B"
printer_array(4) = "\\SitePrntSrv\Hp2100_C"
printer_array(5) = "\\SitePrntSrv\hp 4100"
printer_array(6) = "\\SitePrntSrv\tek 360"

for i= 0 to 6
on error resume next 'script will not fail if one or many items fail
WshNetwork.AddWindowsPrinterConnection (printer_array(i))
next