• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 82
  • Last Modified:

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

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
Thor2923
Asked:
Thor2923
  • 3
  • 3
1 Solution
 
NiabingiCommented:
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
 
Thor2923Author Commented:
AMAZING! thanks...so is that a VBS i call from the .bat file or can I just put that code in the .bat?
0
 
Thor2923Author Commented:
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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
NiabingiCommented:
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
 
Thor2923Author Commented:
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
 
NiabingiCommented:
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now