Posted on 10-01-2008 08:54 AM
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
Posted on 07-25-2012 01:44 PM
I've used this in the past with success.
lpstat -p | cut -d' ' -f2 | xargs -I{} lpadmin -x {}
Posted on 07-27-2012 09:52 AM
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
Posted on 06-06-2013 09:16 AM
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
Posted on 06-09-2013 04:42 AM
The second one works fine with me. I let it run daily to get rid of all the bonjour printers the users set up.