I wrote a script that adds 10 printers to a user's computer. The script works great except it only adds the first 6 printers. If I run it again it will add the 7 printer, run it again it'll add the 8th printer and so on. Is there a minimum # of printers the script can add? Is there anyway around this?
Script:
Option Explicit
Dim objNetwork, strLocal, strUNCPrinter1, strUNCPrinter2, strUNCPrinter3, strUNCPrinter4, strUNCPrinter5, strUNCPrinter6, strUNCPrinter7, strUNCPrinter8, strUNCPrinter9, strUNCPrinter10
strUNCPrinter1 = "\\printname"
strUNCPrinter2 = "\\printname"
strUNCPrinter3 = "\\printname"
strUNCPrinter4 = "\\printname"
strUNCPrinter5 = "\\printname"
strUNCPrinter6 = "\\printname"
strUNCPrinter7 = "\\printname"
strUNCPrinter8 = "\\printname"
strUNCPrinter9 = "\\printname"
strUNCPrinter10 = "\\printname"
Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection strUNCPrinter1
objNetwork.AddWindowsPrinterConnection strUNCPrinter2
objNetwork.AddWindowsPrinterConnection strUNCPrinter3
objNetwork.AddWindowsPrinterConnection strUNCPrinter4
objNetwork.AddWindowsPrinterConnection strUNCPrinter5
objNetwork.AddWindowsPrinterConnection strUNCPrinter6
objNetwork.AddWindowsPrinterConnection strUNCPrinter7
objNetwork.AddWindowsPrinterConnection strUNCPrinter8
objNetwork.AddWindowsPrinterConnection strUNCPrinter9
objNetwork.AddWindowsPrinterConnection strUNCPrinter10
WScript.Quit
Script:
Option Explicit
Dim objNetwork, strLocal, strUNCPrinter1, strUNCPrinter2, strUNCPrinter3, strUNCPrinter4, strUNCPrinter5, strUNCPrinter6, strUNCPrinter7, strUNCPrinter8, strUNCPrinter9, strUNCPrinter10
strUNCPrinter1 = "\\printname"
strUNCPrinter2 = "\\printname"
strUNCPrinter3 = "\\printname"
strUNCPrinter4 = "\\printname"
strUNCPrinter5 = "\\printname"
strUNCPrinter6 = "\\printname"
strUNCPrinter7 = "\\printname"
strUNCPrinter8 = "\\printname"
strUNCPrinter9 = "\\printname"
strUNCPrinter10 = "\\printname"
Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection strUNCPrinter1
objNetwork.AddWindowsPrinterConnection strUNCPrinter2
objNetwork.AddWindowsPrinterConnection strUNCPrinter3
objNetwork.AddWindowsPrinterConnection strUNCPrinter4
objNetwork.AddWindowsPrinterConnection strUNCPrinter5
objNetwork.AddWindowsPrinterConnection strUNCPrinter6
objNetwork.AddWindowsPrinterConnection strUNCPrinter7
objNetwork.AddWindowsPrinterConnection strUNCPrinter8
objNetwork.AddWindowsPrinterConnection strUNCPrinter9
objNetwork.AddWindowsPrinterConnection strUNCPrinter10
WScript.Quit