Solved

batch file to add printer and delete printer

Posted on 2009-05-15
5
3,121 Views
Last Modified: 2013-11-10
i need to write a batch that will add a shared printer on boot up and then delete that same printer on  shutdown. This will go on a vista client...any idea?
0
Comment
Question by:richardjones1025
5 Comments
 
LVL 3

Expert Comment

by:cclassen
ID: 24399392
if you run logon and logoff scripts (controlled through group policy)
in login script
net use \\printservername\printername

in logoff script
net use \\printservername\printername /d
0
 

Author Comment

by:richardjones1025
ID: 24399495
C:\Documents and Settings\Richard Jones>net use \\ga1\Canon6 /delete
The network connection could not be found.

More help is available by typing NET HELPMSG 2250.
0
 
LVL 21

Accepted Solution

by:
AmazingTech earned 125 total points
ID: 24399677
logon script

rundll32 printui.dll,PrintUIEntry /in /n\\server\printer

logoff script

rundll32 printui.dll,PrintUIEntry /dn /n\\server\printer

PrintUIEntry is case sensitive.
0
 
LVL 8

Assisted Solution

by:JT92677
JT92677 earned 125 total points
ID: 24451483
The command

C:\Documents and Settings\Richard Jones>net use \\ga1\Canon6 /delete

should be

C:\Documents and Settings\Richard Jones>net use lpt1: /delete

The "/D? switch in the net use removes the connection between the device (LPT1:) and whatever it is connected to (which once connected, is known by the Operating system)

The other parts of the solution look fine, but the /Delete switch is applied only to the device, not to the path.

Hope this helps.

Jeff



0
 

Author Closing Comment

by:richardjones1025
ID: 31582058
both solutions work
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

A short article about a problem I had getting the GPS LocationListener working.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

914 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

18 Experts available now in Live!

Get 1:1 Help Now