Reset Printing System from Command Line?

robb1068
Contributor

Is anyone familiar with a way to run the Reset Printing System from the
command line? Since OSX 10.5 requires an administrator password just to add
and remove printers, I'm building a Self Service package that our end users
can use and I'd like to include a shell script that would allow them to
reset their printing system.

Thanks!

Robb Gibson
System Engineer - eMMS, Publishing Systems
OfficeMax : 263 Shuman Blvd. : Naperville, IL 60563
(630) 864-5242

4 REPLIES 4

adiSean
New Contributor III

I've used this in the past with success.

lpstat -p | cut -d' ' -f2 | xargs -I{} lpadmin -x {}

rmanly
Contributor III

another way to skin this cat with no call to external programs for text processing:

#!/bin/bash

# removes all printers using filename prefix from .ppd files

shopt -s nullglob

for file in /etc/cups/ppd/* ; do
    path=${file%.ppd};
    name=${path##*/};
    lpadmin -x ${name};
done

donmontalvo
Esteemed Contributor III

Both of these work...are there any benefits/drawbacks for either?

#!/bin/bash
lpstat -p | cut -d' ' -f2 | xargs -I{} lpadmin -x {}
exit 0

or

#!/bin/sh
for file in /etc/cups/ppd/*
    do
      path=${file%.ppd}
      name=${path##*/}
      lpadmin -x "${name}"
    done
exit 0
--
https://donmontalvo.com

tobiaslinder
Contributor II
Contributor II

The second one works fine with me. I let it run daily to get rid of all the bonjour printers the users set up.