PDA

View Full Version : Solved: Map and make default a printer



OTWarrior
07-04-2011, 06:43 AM
Came across this code, thought I would share:


1) Copy the text below the line

2) Amend the server and printer names (strPrinterUNC = \\Servername\Printername)

3) Save as a VBS file on the network

4) Repeat steps 1-3 for different printers

5) Send people the link to the file.


Note: This both maps and sets the printer as default. If the printer is already there, it will just map it.



----------------------------------

Option Explicit
Dim strPrinterUNC, objNetwork

strPrinterUNC = "\\Servername\Printername"

Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection strPrinterUNC
objNetwork.SetDefaultPrinter strPrinterUNC
Set objNetwork = Nothing

msgbox "Printer '" & strPrinterUNC & "' Mapped and set as default"