# How can I map a network printer but not have it be the default?



## justcrash (Aug 7, 2009)

I am mapping two network printers to the students in my school district, at the high school. Every classroom has it's own printer the students should use. The two mapped printers are for the two computer labs that I do not want to install on each machine speficially. So in effect, I want the two printers mapped, but NOT made the default printers on the machines, but rather use the default printer already on the machines.

Currently the script I am using reads as follows:

' VBScript to map two printers from two servers
' Guy Thomas January 2005.
' ----------------------------------------
Option Explicit
Dim multiPrinter, UNCpath1, UNCpath2
UNCpath1 = \\e101\lhhs131
UNCpath2 = \\e101\lhhs132
Set multiPrinter = CreateObject("WScript.Network") 
multiPrinter.AddWindowsPrinterConnection UNCpath1
multiPrinter.AddWindowsPrinterConnection UNCpath2*
*WScript.Quit
' End of Script

What should I be adding to stop these from being the default printers?


----------



## jmwills (Sep 28, 2005)

Only one can be the default, so I would try adding the one you already have to the end of the script and see if that "fools" Windows.


----------



## justcrash (Aug 7, 2009)

jmwills said:


> Only one can be the default, so I would try adding the one you already have to the end of the script and see if that "fools" Windows.


That is a good idea, the only issue is, I work in a k-12 public school district, and every class room has it's own printer, so most of the machines have the printer in that room set to default. So we are talking well over 300 classrooms with a printer in each of those rooms. So what I guess I need the script to do is say don't make ANYTHING the default, maybe?

I dunno, I am at a loss. I can't get a per-machine policy to work for the printers, that would solve all of this (I have my labs in different OUs).


----------



## justcrash (Aug 7, 2009)

jmwills said:


> Only one can be the default, so I would try adding the one you already have to the end of the script and see if that "fools" Windows.


 Is there a generic printer name I could use to reflect the one already on the machine, like %USERPROFILE% is generic?


----------



## jmwills (Sep 28, 2005)

This script should fix your issue:

Option Explicit
Dim objPrinter
Set objPrinter = CreateObject("WScript.Network")
objPrinter.SetDefaultPrinter "\\ServerName\PrinterName"


----------



## justcrash (Aug 7, 2009)

jmwills said:


> This script should fix your issue:
> 
> Option Explicit
> Dim objPrinter
> ...


 What will this do? It looks like I will have to create a default printer for every room, which won't work for me (because of what I mentioned above). Is that correct, sir?


----------



## peterh40 (Apr 15, 2007)

What I do is create a folder on the C: drive with the name of the LAB and when a student logs into that room, the script checks for the existance of that folder, and set the correct default printer for that room so prints go to the correct printer!

Dim fso
Dim objPrinter
Set fso = CreateObject("FileSystemObject")
Set objPrinter = CreateObject("WScript.Network")
if fso.FolderExists("C:\Lab1") then
objPrinter.SetDefaultPrinter "\\server\Lab1_Printer"
elseif fso.FolderExists("C:\Lab2") then
objPrinter.SetDefaultPrinter "\\server\Lab2_Printer"
endif

and so on.


----------



## avisitor (Jul 13, 2008)

Is there a reason you can't apply this using Group Policy to just your lab OUs? Printer Connections can be managed by Group Policy.


----------

