Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3131
  • Last Modified:

batch file to add printer and delete printer

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
richardjones1025
Asked:
richardjones1025
2 Solutions
 
cclassenCommented:
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
 
richardjones1025Author Commented:
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
 
AmazingTechCommented:
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
 
JT92677Commented:
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
 
richardjones1025Author Commented:
both solutions work
0

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

Tackle projects and never again get stuck behind a technical roadblock.
Join Now