Skip to main content
Question

Reset Printing System from Command Line?


Forum|alt.badge.img+8
  • Contributor
  • 62 replies

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

Forum|alt.badge.img+6
  • Contributor
  • 10 replies
  • July 25, 2012

I've used this in the past with success.

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


Forum|alt.badge.img+12
  • Contributor
  • 312 replies
  • July 27, 2012

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
Forum|alt.badge.img+36
  • Legendary Contributor
  • 4293 replies
  • June 6, 2013

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

tobiaslinder
Forum|alt.badge.img+16
  • Valued Contributor
  • 101 replies
  • June 9, 2013

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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings