Solved

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

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

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

Join & Write a Comment

Greetings, Experts! First let me state that this website is top notch. I thoroughly enjoy the community that is shared here; those seeking help and those willing to sacrifice their time to help. It is fantastic. I am writing this article at th…
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 …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

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

13 Experts available now in Live!

Get 1:1 Help Now