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?
LVL 1
wolf2008Asked:
Who is Participating?
 
AmazingTechConnect With a Mentor Commented:
It's been about 2 years since I've played with the printui.dll so if my memory is a little hazy please give me some time to relearn this tool if needed. I will help you in every way. Need explanations just ask.

Want to delete all GAs?

The Reg Copy is just so we have a backup if we accidentally delete something we shouldn't have.

Of course with REG you can do this remotely as well.
reg copy HKLM\SYSTEM\CurrentControlSet\Control\Print\Connections HKLM\SYSTEM\CurrentControlSet\Control\Print\Connections.Saved /s /f
reg delete HKLM\SYSTEM\CurrentControlSet\Control\Print\Connections /f

Open in new window

0
 
sirbountyCommented:
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

0
 
wolf2008Author Commented:
It looked like it worked at first, but when I logged off then on, the printers came back.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 
sirbountyCommented:
Logon script recreating them perhaps?
0
 
wolf2008Author Commented:
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.
0
 
Paolo SantiangeliConsulente InformaticoCommented:
0
 
wolf2008Author Commented:
Did not work.  The printer came back when I restarted the Print Spooler Service.
0
 
sirbountyCommented:
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...
0
 
wolf2008Author Commented:
sirbounty: You added the printers with the "rundll32 printui.dll PrintUIEntry /ga /n\\server\printer" command?
0
 
wolf2008Author Commented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.