Solved

batch file to add printer and delete printer

Posted on 2009-05-15
5
3,124 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

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…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

679 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