Adding spoolss printers through Terminal

New Contributor III

My campus has about 700 printers spread between 20 buildings. In an effort to make the network more secure, printers have been moved to their own 10.x.x.x subnets, but this requires printers to be added via Spoolss on Macs. Given the complexity of the process, it can be too much for our faculty and I would like to find a way of them being available in self-service without completely crowding the interface.

I was thinking I could script something to map a printer via spoolss using smb://<print server>/<printer name> and leave a variable for the printer name that could be added via popup by the user. Some searching around did not turn up any results for adding a spoolss printer via command line in terminal and I was wondering if anyone on here had any experience with doing this in the past.


Contributor II

I'm going to assume for now that the spoolss requirement has to do with user authentication to the print server. If so, and your users are logged into an AD account, or have some other way of passing their user credentials automatically to the print server, I think all you need to do is set the auth-info-required printer option when scripting the printer setup:

lpadmin -p printerName -E -v smb://printserver/printername -m "/path/to/ppd.gz" -L "Room" -o auth-info-required=negotiate -o printer-is-shared=false -o <<any other options>>