Link to home
Start Free TrialLog in
Avatar of wolf2008
wolf2008Flag for United States of America

asked on

Is there a way to delete all printers with the rundll32 printui.dll PrintUIEntry command?

I have different printers installed on different machines, all with the /ga command.  Is there a way to delete them with the rundll32 command without specifying the server or printer name?
Avatar of sirbounty
sirbounty
Flag of United States of America image

Sure - there's a built-in script to do it...
run this from the command line:
cscript prnmngr.vbs -x -s %computername%

Open in new window

Avatar of wolf2008

ASKER

It looked like it worked at first, but when I logged off then on, the printers came back.
Logon script recreating them perhaps?
No logon scripts, either locally or through Group Policy.  I'm able to delete them with the /gd command, but you have to know each \\servername\printername and there are far too many combinations set on these computers.  There's gotta be a way to script it.
Did not work.  The printer came back when I restarted the Print Spooler Service.
I still think there's some automated method reproducing them...I ran the script on my system and my printers are gone...even after a reboot...
sirbounty: You added the printers with the "rundll32 printui.dll PrintUIEntry /ga /n\\server\printer" command?
ASKER CERTIFIED SOLUTION
Avatar of AmazingTech
AmazingTech

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks!  I tested it with both lines in a .bat file, and it worked.  I then created a .bat file with the following:

reg delete HKLM\SYSTEM\CurrentControlSet\Control\Print\Connections /f
net stop spooler
net start spooler