Solved

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

Posted on 2006-11-14
5
250 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
[X]
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
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A common practice in small networks is making file sharing easy which works extremely well when intra-network security is not an issue. In essence, everyone, that is "Everyone", is given access to all of the shared files - often the entire C: drive …
Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
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 …

733 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