How do I remove printers with a simple script?



I am attempting to create a script to be placed on lab
computers so when users login the printer for that lab is
installed. The printer install script works fine, but the
script does not check to see if the printer exists. If a
user logs in multiple times in the same lab the printer is
installed at each login, which is a problem.

How do I have the script either check to see if the
printer is installed or get it to delete the printer if it
is there, then reinstall it? Below are the commands im

rundll32 printui.dll,PrintUIEntry /if /b "test" /f %windir%
\inf\ntprint.inf /r "\\stingray\lab035" /m "HP Laserjet
5m" /Z /q

REMOVE PRINTER(does not work):
printui.dll,PrintUIEntry /dl /b "test" /c\\helpdesk1

Classes start soon, so if anyone gets any further please e-
mail me.

-Devin Radziej

Oli Restorick

On Windows 2000 and above, take a look at the following:

rundll32 printui.dll,PrintUIEntry /?

It will give you a help screen for PrinUI functions, three of which relate
to deleting printers. Note that the "PrintUIEntry" bit is case-sensitive.

Searching on that term should give you some useful information, although
I've only ever used this to add printers rather than delete them.



Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question