Solved

Will printers mapped by a login script overwrite locally added printers?

Posted on 2006-11-14
5
247 Views
Last Modified: 2010-03-18
I want to add 3 or 4 "Main" printers to my batch file so that EVERYONE gets them mapped automatically at logon.  So if I have these 4 printers mapped using a login script, will the script simply add these printers to everyone printer list, or will it also delete any mapping they had to these or other printers previously?
0
Comment
Question by:tenover
  • 2
  • 2
5 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 17940414
I believe you will get a "device in use" error.
You can trap for it though - do you need help setting up that part of your script?
0
 

Author Comment

by:tenover
ID: 17940496
I would leve help, thanks.  The only thing I have in my current login script is a single mapping to a "Shared" drive.  Home directories are mapped via the users profile.
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 17940743
In its simplicity...and to correct what I 'tried' to say before - I believe I was referring to replacing the default printer... : $


Dim objNetwork
Dim aryPrn(3)
Dim prn

set objNetwork=CreateObject("Wscript.Network")

aryPrn(0)="\\PrintServer\Printer1"
aryPrn(1)="\\PrintServer\Printer2"
aryPrn(2)="\\PrintServer\Printer3"
aryPrn(3)="\\PrintServer\Printer4"

on error resume next
For each prn in aryPrn
  objNetwork.AddWindowsPrinterConnection prn
  if err.number <> 0 Then
    msgbox "Unable to attach to printer " & prn
  end if
Next

'Optionally  objNetwork.SetDefaultPrinter "\\PrintServer\Printer1")

Set objNetwork = Nothing

wscript.quit
0
 
LVL 43

Accepted Solution

by:
Steve Knight earned 500 total points
ID: 17941801
You can also simply add the commands to the batch file itself if you want to stick with batch files rather than VBS (or call the VBS from your bacth file or change all to VBS, your call)

if not exist %userprofile%\printer1.txt start \\server\printer1 & echo Installed > %userprofile%\printer1.txt

which installs the printer and drops a flag file in the user's profile so it doesn;t install it again.  User will get a "printer xyz installed OK" pop up the same as typing \\server\printer1 in start | run box
or similar with:
rundll32 printui.dll,PrintUIEntry /ga /n\\server\printer1 /y

VBS looks nicer and is maybe a bit more controllable, if you prefer batch look at these ways

hth

Steve
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 18544446
Thanks for the points, hope it helped

Steve
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enterprise networks where VoIP phones have been deployed frequently use port configurations that allow both a computer and an IP phone to be plugged into the same switch port but use different VLANs. On Cisco equipment I'm referring to the "native V…
I'm a big fan of Windows' offline folder caching and have used it on my laptops for over a decade.  One thing I don't like about it, however, is how difficult Microsoft has made it for the cache to be moved out of the Windows folder.  Here's how to …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

932 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

15 Experts available now in Live!

Get 1:1 Help Now