Solved

batch file to add printer and delete printer

Posted on 2009-05-15
5
3,123 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Suggested Solutions

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
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…

856 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