HOW-TO: Command Line Connect to a CUPS Network Printer for Ubuntu Linux

There seems to be a bug in Ubuntu in that when you reboot the system all remote CUPS printer connections are forgotten. This sounded like something needing a bit of scripting magic, so I went searching for how to accomplish that. Turns out it was quite simple actually. The utility lpadmin will be your friend to command line administer printers / print queues. The first lpadmin command attaches to the CUPS shared network printer queue via the IPP protocol, and the second lpadmin command sets the printer as the system default.

/usr/sbin/lpadmin -p HPLaserJet-4000-PS-CUPS -E -v ipp://ldslnx01/printers/HPLJ4000-PS
/usr/sbin/lpadmin -d HPLaserJet-4000-PS-CUPS

I shall add that to my workstation's /etc/rc.local file to be run each time the system boots up. Done!

Update: I found this same syntax works with Xubuntu 12.04. I could not find the GUI way to attach to a CUPS network printer, but the above command line syntax mapped my printer beautifully!