Solved

I have an old print server that is Windows 2003. I need to map printers usering a login script...any suggestions?

Posted on 2016-08-02
6
47 Views
Last Modified: 2016-08-08
I have a branch that still has an old 2003 print server. I cannot add Print Management to it. I need to simply add 3 printers to each user's login script. I forgot the syntax. All suggestions welcome..should i stick with .bat or use vbs?
0
Comment
Question by:Thor2923
  • 3
  • 3
6 Comments
 
LVL 4

Expert Comment

by:Niabingi
ID: 41739234
On Error Resume Next
Dim netPrinter, newprt1
Set netPrinter = CreateObject("New-Object -Com WScript.Network")
newprt1 = "\\printserver\printer"
newprt2 = "\\printserver\printer"
netPrinter.AddWindowsPrinterConnection newprt1, True
netPrinter.AddWindowsPrinterConnection newprt2, True
netPrinter.SetDefaultPrinter "\\printserver\printer"



you can set it in the startup folder so it runs when the user logs in
0
 
LVL 1

Author Comment

by:Thor2923
ID: 41739275
AMAZING! thanks...so is that a VBS i call from the .bat file or can I just put that code in the .bat?
0
 
LVL 1

Author Comment

by:Thor2923
ID: 41739442
ooops I just read your last line about the start up folder. I was hoping to call this or make this the .bat file that users in a local office have for a login script. Will this work?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 4

Accepted Solution

by:
Niabingi earned 500 total points
ID: 41739793
for the batch file this should work


@Echo Off


Add printer
rundll32 printui.dll,PrintUIEntry /in /n\\printserver\printer

Set printer as default
rundll32 printui.dll,PrintUIEntry /y /in\\printserver\Printer






OR powershell

$PrinterPath = "\\PRINTSERVER\PRINTER"
 $net = new-Object -com WScript.Network
 $net.AddWindowsPrinterConnection($PrinterPath)
0
 
LVL 1

Author Comment

by:Thor2923
ID: 41740553
oh thanks....is there an advantage to using Powershell? is there a way to bypass the install if the printers are already mapped? I am still in early testing, but it appears that workstations will go through quite an extensive install process on every reboot. I guess the work around is to change the login script after a user is initially setup, but if I could make it more permanent that would be great
0
 
LVL 4

Expert Comment

by:Niabingi
ID: 41740648
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Printers have changed substantially in the last 30 or so years, not just in technical capabilities but in cost and usage as well.  Printers were originally used for interfacing with the operator, not necessarily for printing copy or pictures. In …
Find out how to use Active Directory data for email signature management in Microsoft Exchange and Office 365.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now