We are trying to push out a script that deletes all printers. That part of it works just fine.
We use the following:
# Get all printers and remove them
# Log printer names
echo "Removing all printers..."
for printer in `lpstat -p | awk '{print $2}'`
do
echo $printer >> "/Library/LOGGINGFOLDER/$logname"
lpadmin -x $printer
done
We use logging in case we need to reinstall anything later.
Problem is that when there aren't any printers to delete then the exit code is 1 and an error notification is triggered. How do I test if printers are installed before continuing? else would be exit with code 0 (success).
Thanks for the help!
