Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2006-11-14
5
249 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The Need In an Active Directory enviroment, the PDC emulator provide time synchronization for the domain. This is important since Active Directory uses Kerberos for authentication.  By default, if the time difference between systems is off by more …
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 …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

840 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