Batch Deleting Printers
I’d like to remove around 2,400 printers from the database (that were added before I discovered the “ignore printers” option, and was wondering if there is a way I can write or get a script to delete them?
Different methods to delete printers
It’s possible to manually remove printers in PaperCut, as documented in our manual, Add and remove/delete/ignore printers, but that can mean a lot of clicks when you have hundreds or even thousands of printers in PaperCut. So what should you do?
Thankfully as with anything in PaperCut there’s usually half-a-dozen ways to solve the problem.
-
If this is a new PaperCut server and not yet in production, one simple option could be uninstall and re-install PaperCut NG or MF, resetting the data.
-
If you are wanting to do this after renaming your print server, we have an article just for that over here: Removing duplicate printers after a server name change.
-
Or if you are the industrious type, it’s possible to script this using the
delete-printer
method in our Server Command API as described below. -
One of our channel partners has also created PowerShell and Bash scripts that use our Server Command API in conjunction with printer list exports to help automate this process too.
Deleting printers in bulk from PaperCut with Server Commands
-
On the PaperCut server open a command prompt as an administrator.
-
Navigate the the server-command directory, for example on a 64-bit Windows server running PaperCut NG, you could use the command:
cd C:\Program Files\PaperCut NG\server\bin\win
. -
Run the command
server-command delete-printer <servername> <printername>
.-
Repeat that line above for each printer to delete. To make this go really quickly, you can download a CSV list of printers from PaperCut (on the Printers tab, scroll to the bottom and click the small green CSV icon). Then open that file in your favorite spreadsheet editing program, and then use the CONCATENATE function to build out a list of server commands to delete all the printers you want to get rid of.
-
If you want to delete all printers on a particular server, you can use the following command:
delete-printer <server_name> “[All Printers]”
. Just replace thewith the name of the server. You must use the quotes around the [All Printers]
text.
-
What if the printers reappear in PaperCut?
Well, that’s because some PaperCut Secondary Server or workstation running the Direct Print Monitor is out in your network running the Print Provider service and is reporting it’s list of printers to the PaperCut server. You’ll need to track down that workstation or server and uninstall the software, or configure it to ignore the specific printers.
Categories: How-to Articles , Print Queues
Keywords: delete , bulk delete , remove multiple printers
Last updated June 13, 2024
Comments