Doing a shell script to manage printers with CUPS

I’ve written a script using some “do shell script lpadmin…” statements to delete and recreate printers for a lab setting. Using lpadmin works fine for creating the printers, but leaves the details of the printers’ “installed options” set to their default. Therefore I’m looking for a way to specify those settings for things like installed memory, printer hard disk, paper trays, etc.

Is there a way to script these settings through CUPS? These settings can be set by hand either through Print Center or the CUPS admin (127.0.0.1:631). Surely they can be scripted, right?

Thanks for any ideas.

We use a SAMBA print server to authenticate staff users (students are prevented from using staff queues). Installation of SAMBA printers is lengthy, at best.

I’ve been trying to script the install, piping for username, password and printer. lpadmin PARTIALLY works. Does anyone have a flashlight they can shine on this?

TIA!

I decided to utilize some customized PPD files for the printers I’m setting up with my script. I just opened the existing PPD file and changed the necessary settings then saved with a different name specific to the printer and it’s location. Then in my script, I just reference the new PPD file with all the settings already intact. Works just fine this way.

…However, I’m still hunting for a way to use lpadmin to delete all installed printers collectively, instead of having to refer to them one at a time. The Mac OS X version of lpadmin is missing the “-x all” functionality that will do this in one fell swoop. Maybe there’s a way I can use lpstat to get a listing of the printers and clean out the extra info to make a list of printers installed and delete them one at a time using that list?..