Help with adding shared printers via terminal

Hello, I'm very familiar with adding printers via the command line:

lpadmin -p queue name -v ipp://172.xx.xx.xx -E -D "description" -L "location" -m everywhere (or ppd file)

However, I have a lab of iMacs at my school which have traditionally connected to a dedicated "printer server" iMac, which has 4 high quality Epson Ink Jets connected via USB and shared through Printer Sharing preferences. Well, something changed recently on the network and it's broken all installs of the printers and now we have to manually re-install these individually. I'd like to be able to simply use the lpadmin command that I already know to be able to re-install these printers, but they don't individually have IP addresses, so I'm stuck trying to get them to install via the printer server iMac.


How do I address the printers for use with the lpadmin command? I've discovered that running

lpinfo -v

shows me a very comprehensive list of all the printers being broadcast on my subnet, and I can find the printers listed here as with a very long dnssd address:

dnssd://NAME%20OF%20PRINTER._ipp._tcp.local./?uuid=A1ABC5D6-9870-4EC8-80BE-A8A0F 68A662B

I was hoping that I could simply copy this address and use it for my device_uri, but it doesn't work. If I use the "everywhere" model, then it fails saying it can't find the file and if I point it directly at the PPD, it installs, but there's no communication to the printer from the new print queue.


Can anyone please point me on the right path to being able to programmatically add printers to Macs that are being shared via bonjour?


Thanks!

MacBook, macOS High Sierra (10.13.4)

Posted on Sep 28, 2018 11:37 AM

Reply

Similar questions

19 replies

Oct 3, 2018 8:13 AM in response to atoss

I don't think you need to reference the UUID, and you probably also aren't going to be using the DDNS (Dynamic DNS, Bonjour, ZeroConf) host (printer) name here.


The ._ipp._tcp.local. is the rest of the DDNS host name. Most network printers are at fixed IP addresses and with a DNS translation configured, so there's usually a traditional (non-dynamic) DNS name for those. If I were guessing what might have happened here, I'd wonder if the IP network was repartitioned somehow and the DDNS traffic was not being propagated.


Some related reading on command-line printer configurations:


http://dae.me/blog/1826/add-a-printer-via-command-line-in-os-x/

Setting Up and Administering Printers by Using CUPS Command-Line Utilities - Oracle Solaris Administration: Common Tasks

Install Printers On A Mac From The Command Line | REDline


And for a completely different approach that might be interesting to you:

Generating printer configurations using payload-free_package_printer_generator.sh | Der Flounder

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Help with adding shared printers via terminal

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.