img

How do you bulk delete printers in PaperCut?


We get asked fairly often if it’s possible to quickly delete printers from PaperCut. You could do it the old fashioned way (you know, manually) but why would you want to do that – you have a coffee to drink! šŸ˜‰

There is already a handy KB article available from PaperCut which covers one way to do this… But, as you know we like to be a bit different – so, to make life a tad easier we have a couple of scripts that we use, and thought we’d share them with you.

Why might you want to delete printers en masse?

  • You might have multiple printers that you need to delete, and little time to do it
  • You didn’t know that there was an ā€œignore printersā€ option when you added the devices to PaperCut

How to delete printers in bulk

This is the way to remove printers in bulk that we like to use, which works in most scenarios.

Go to Printers and click on the CSV/Excel icon at the bottom of the page – delete the first 2 lines and any lines which contain the printers that you’d like to keep, so the file will only contain a list of the printers you want to remove.

Update the serverCommand and csvPath in the script and give it a run.

Powershell

CLS

$serverCommand = 'C:\Program Files\PaperCut MF\server\bin\win\server-command.exe'
$csvPath = 'C:\temp\printer_list.csv'

$csvData = Import-CSV $csvPath -Header server,printer

ForEach ($printer in $csvData) {
    &$serverCommand delete-printer $printer.server $printer.printer
}

Bash

#!/bin/bash

serverCommand=/home/papercut/server/bin/linux-x64/server-command
csvPath=/home/papercut/temp/printer_list.csv

while IFS="," read -r serverName printerName theRest
do
        "${serverCommand}" delete-printer $serverName $printerName
done < $csvPath

The other way to delete printers in bulk...

The same process can be used to remove devices if needed but instead of exporting the list of printers you would go to Devices, click the CSV/Excel icon at the bottom, remove the top two lines and any devices you'd like to keep, then use the script below.

Powershell

CLS

$serverCommand = 'C:\Program Files\PaperCut MF\server\bin\win\server-command.exe'
$csvPath = 'C:\temp\device_list.csv'

$csvData = Import-CSV $csvPath -Header device

ForEach ($device in $csvData) {
        &$serverCommand delete-printer ($device.device -split '\\')[0] ($device.device -split '\\')[1]
}

Bash

#!/bin/bash

serverCommand=/home/papercut/server/bin/linux-x64/server-command
csvPath=/home/papercut/temp/device_list.csv

while IFS="," read -r device theRest
do
        $serverCommand delete-printer $(echo $device | cut -d "\\" -f 1) $(echo $device | cut -d "\\" -f 2)
done < $csvPath

We hope you find this useful! Remember, if you need custom scripts for PaperCut get in touch with the team!

Latest News from Jonathan Bennetts
img

PaperCut and Access Management

Access Management and Identity as a Service (IDaaS) solutions for PaperCut...

Written by: Jonathan Bennetts

More
img

PaperCut ends client support for 32-bit operating syst...

A long time ago, in a country far far away... PaperCut announced they were...

Written by: Jonathan Bennetts

More

img

Selectec have proved to be a great company to partner with. I have worked with Selectec for 7 years now, and am always impressed with their professionalism and eagerness to help. Both with sales and technical support, Selectec have always strived to give any information that I need, and gone above and beyond when Iā€™ve needed a little extra help. I canā€™t recommend them highly enough.

Jon Farquharson Abbey Business Group
Back to Top ↑