Remove Printers Policy

jafuller
Contributor

I need a way to clear all printers from a computer. I don't know/care what printers are installed, but I'll need to be able to remove or clear out all printers from the computer. Is there a way to do that?

I'm not very familiar with CUPS, so any direction would be great. Thank You!
--
James Fuller | Starbucks Coffee Company | Technology Application Services | Application Developer

6 REPLIES 6

stevewood
Honored Contributor II
Honored Contributor II

It's kind of brute force, but simply removing the printers.conf file will
On Wed, Nov 10, 2010 at 10:55 AM, James Fuller <JaFuller at starbucks.com>wrote:
work:

rm -rf /etc/cups/printers.conf

Then a restart of the CUPS process:

killall cupsd

Unless someone else has another idea. :-)

Steve Wood
Director of IT
swood at integer.com

The Integer Group | 1999 Bryan St. | Ste. 1700 | Dallas, TX 75201
T 214.758.6813 | F 214.758.6901 | C 940.312.2475

Not applicable

I believe this gets the job done...

rm -f /etc/cups/printers.conf
rm -f /etc/cups/ppd/*

mfennelly
New Contributor III

This is what we use.

---------------------------------------------------
#This script is to clear out the printers file
#written by Maura Fennelly
# 2010-02-11

killall cupsd

mv /etc/cups/printers.conf /etc/cups/printers.old

cupsd

Janowski
New Contributor II

we used that same solution for a very long time in our pre-casper days. now all of our printers are managed through the JSS. The command seems to work pretty well, but like you said, it's brute force. That just means it won't care is stuff is in use - it just blasts it away regardless.

ben janowski
Senior Macintosh Support Technician
Kohl's Mac Support Team
262.703.1396 | benjamin.janowski at kohls.com

Eyoung
Contributor

I generally do these via ARD but the commands script fine. you need to know the print queue names, but I have found that extraneous queues listed just get ignored so I often build out lists with a slew of known queues.

to cancel all current jobs (the labs get this as a logout policy... kids love sending bad jobs to printers) and make sure the existing queues are enabled:

cancel -a
cupsenable print queue goes here

I also use lpstat -a

this will list the current queues and the status of them. handy for the random "I can't print" call

We lay down printers via MCX so I use: lpadmin -x print queue goes here (mcx_0 etc...). this is helpful is there is a driver update or hardware has been replaced.

rudimentary I know, but my scripting kung fu is weak.

rmanly
Contributor III

I needed to do this a while ago and here is what I came up with. It takes
the name of the printer from the PPD filename and then removes it using
lpadmin.

#!/bin/bash

for printer in `ls /etc/cups/ppd | cut -d . -f1`; do lpadmin -x $printer
done

exit 0

Ryan M. Manly
Glenbrook High Schools