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

We have worked with Selectec for over 5 years. With their support we have been able to satisfy our direct and indirect clients with an extremely quick turnaround time in the supply of software. Their customer service is outstanding. The personal touch they offer, their flexibility and quick reaction time, comforts us in knowing that if things were to go wrong, the support is always there.

John Sweeney, Head of Product & Solutions Support Group Toshiba UK
Back to Top ↑