Batch file to delete printer

Hi,

I'd like a batch file to delete a printer and I'm stumped at what should be a pretty simple task.

So my user can go to 'Printers and Devices' and manually remove the printer no problem.

I first tried a simple reg delete batch file: 

reg delete "hkcu\printers\connections" /f

Printer does actually disappear but after 5-10secs or a refresh, it reappears in Printers and devices. I couldn't work out why so I moved on.

I then tried:

RUNDLL32 printui.dll,PrintUIEntry /n \\server\printer name /dn

But get a message reporting arguments are invalid.

I'm clearly doing something really silly but could anyone spot what it is? Help greatly appreciated!

July 2nd, 2015 10:30am

Using a Google search phrase such as

command line to delete printer

will give you lots of good hints, e.g. this one: http://www.robvanderwoude.com/2kprintcontrol.php

Free Windows Admin Tool Kit Click here and download it now
July 2nd, 2015 1:31pm

Using a Google search phrase such as

command line to delete printer

will give you lots of good hints, e.g. this one: http://www.robvanderwoude.com/2kprintcontrol.php

July 2nd, 2015 5:26pm

Using a Google search phrase such as

command line to delete printer

will give you lots of good hints, e.g. this one: http://www.robvanderwoude.com/2kprintcontrol.php

Free Windows Admin Tool Kit Click here and download it now
July 2nd, 2015 5:26pm

Using a Google search phrase such as

command line to delete printer

will give you lots of good hints, e.g. this one: http://www.robvanderwoude.com/2kprintcontrol.php

July 2nd, 2015 5:26pm

Try this:

wmic printer where "name='NameOfPrinter'" delete

Free Windows Admin Tool Kit Click here and download it now
July 9th, 2015 11:18pm

Try this:

wmic printer where "name='NameOfPrinter'" delete

  • Proposed as answer by havok333 17 hours 20 minutes ago
July 10th, 2015 3:16am

Try this:

wmic printer where "name='NameOfPrinter'" delete

  • Proposed as answer by havok333 Friday, July 10, 2015 1:49 PM
Free Windows Admin Tool Kit Click here and download it now
July 10th, 2015 3:16am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics