Hello All,
Thank you in advance for reading. I've read a few different posts on here about adding printers using a script and before I did so I came up with my own to add about 50-60 printers to a bunch of machines. It is as follows:
#!/bin/bash
# Remove any currently installed printers
lpstat -p | awk '{print $2}' | while read printer
do
echo "Deleting Printer:" $printer
lpadmin -x $printer
done
# Add Printers
/usr/sbin/lpadmin -p QUEUENAME -o printer-is-shared="False" -E -v lpd://10.x.x.x -P /Library/Printers/PPDs/Contents/Resources/HP LaserJet 2420.gz -D "Room Number"
echo "Added Room 1"
/usr/sbin/lpadmin -p QUEUENAME2 -o printer-is-shared="False" -E -v lpd://10.x.x.x -P /Library/Printers/PPDs/Contents/Resources/HP LaserJet 2420.gz -D "Room Number"
echo "Added Room 2"
and so on until the last printer is added
Everything works fine, I just noticed that it'll start adding them really fast and then slow down and sometimes I get an "lpadmin: Undefined error: 0"
It'll continue to add them no problem I was just wondering if this was caused by the amount of printers I was adding at once that kind of "bogs" it down and it's nothing to worry about or if I could script it better to run more efficiently.
Any suggestions are appreciated.
Thank you