Link to home
Start Free TrialLog in
Avatar of mt3dek
mt3dekFlag for United States of America

asked on

Deploying Printers via VBS

I have created a VBS script to add network printers to a specific group of users within a OU.

This has been in place for about 3 months now, and initially since I was changing to new servers, i had to delete all the old printers and add the new ones, hence why i made a scrip to add the new printers. The vbs is deployed through a GPO. That GPO is still enabled. What I dont understand is there is no default printer setting in the vbs, but randomly some machines default printer will change to the first printer on the vbs.

Help please?
ASKER CERTIFIED SOLUTION
Avatar of BlackAdderDK
BlackAdderDK

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of merowinger
merowinger
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mt3dek

ASKER

There are about 20 printers in this script and its set to a OU with about 30 users. They all dont have the same default printer and thats why i didnt specify one in the script. Ive manually gone to each users PC after the script ran and added the printers and changed the default printer. The thing that is not connecting for me, is why intermittently does the default change when i dont have a default specified in the script but have a default set already in windows.

Does this make sense?
Option Explicit
Dim objNetwork, strLocal, strUNCPrinter1, strUNCPrinter2, strUNCPrinter3, strUNCPrinter4, strUNCPrinter5, strUNCPrinter6, strUNCPrinter7, strUNCPrinter8, strUNCPrinter9, strUNCPrinter10, strUNCPrinter11
strUNCPrinter1 = "\\BPBAK\BAKAA2"
strUNCPrinter2 = "\\BPBAK\BAKAA3"
strUNCPrinter3 = "\\BPBAK\BAKAA4"
strUNCPrinter4 = "\\BPBAK\BAKATTY"
strUNCPrinter5 = "\\BPBAK\BAKCF"
strUNCPrinter6 = "\\BPBAK\BAKGFM"
strUNCPrinter7 = "\\BPBAK\BAKLIB"
strUNCPrinter8 = "\\BPBAK\BAKOA"
strUNCPrinter9 = "\\BPBAK\BAKWP1"
strUNCPrinter10 = "\\BPBAK\BAKiR5065-1"
strUNCPrinter11 = "\\BPBAK\BAKiR5065-2"

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
objNetwork.AddWindowsPrinterConnection strUNCPrinter11

WScript.Quit

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mt3dek

ASKER

i didnt know i could specify a default to a username.
The whole purpose of using a printer script is so i dont have to remember to go add printers to a new employees local profile on their machine.
You can also query groups in active directory. So if a new employees joins the company you create the user and make it member of a specific ad group. When it logs on the script will automatically set the correct default printer
Avatar of mt3dek

ASKER

If i already have a default set, is there a line that can be included to not set the default printer or not to modify default printers if there is already a default?
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.