We help IT Professionals succeed at work.
Get Started

VBS script  to map network printers to all users.

365 Views
Last Modified: 2018-03-22
Hi

We have windows 2012 DC and Windows 7 clients in our network.I have installed a black and white and colour printer on a new windows 2012 print server. I am  trying to work out how to use login scripts to map printers for users upon log on.

I found this script and i applied and now when users log in to any network PCs, the printers are mapped successfully.
I wondering, if a User-A logs and the printer gets mapped and once the User-A logs off and another User-B logs into the same PC will the printers be mapped again or if it detects the printer is already mapped will the script ignore mapping the printers again.

Please suggest and add any lines if required in the following script.


Option Explicit
Dim netPrinter, UNCpath
UNCpath = "\\PRINT-SERVER\Black and White Printer"
Set netPrinter = CreateObject("WScript.Network")
netPrinter.AddWindowsPrinterConnection UNCpath
' Here is where we set the default printer
netPrinter.SetDefaultPrinter UNCpath

UNCpath = "\\PRINT-SERVER\Colour printer"
netPrinter.AddWindowsPrinterConnection UNCpath
Wscript.Quit


Thanks any help would be great.
Comment
Watch Question
Senior Consultant
CERTIFIED EXPERT
Awarded 2017
Distinguished Expert 2019
Commented:
This problem has been solved!
Unlock 2 Answers and 3 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE