Canon Uniflow username prompt

rpayne
Contributor II

I'm attempting to deploy Canon's Uniflow follow me printing service. Adding the print driver is easy enough and I can map the printer and add it via jamf admin. The issue I'm having is that the "URL" of the printer (LPD/LPR) is unique for each user as it includes their username. The URL is like this: lpd://<username>@xxxxxxxxxx/PrintAnywhere where I'd like <username> , to be their actual username.

We are currently not bound to any directory service and have not deployed Connect yet (Azure AD). The local user account usernames are the same as their AD username.

My question is this, what is the cleanest way to inject or replace the LDP address with their custom url that includes their username? Canon has been no help and I'll be honest in the fact that I'm not a scripting whiz.

5 REPLIES 5

mm2270
Legendary Contributor II

Will the primary users of the Mac be logged into those devices when the script runs? If so, the following code will get their shortname/username, which you can then place back into the command, I assume. I don't have experience with this Canon printing service myself, so I'm just guessing on the last part.

logged_in_user=$(/bin/echo "show State:/Users/ConsoleUser" | /usr/sbin/scutil | /usr/bin/awk '/Name :/&&!/loginwindow/{print $3}')

So, depending on how you are adding those print URLs during the deployment, if it's being scripted, you would just place that logged_in_user variable into the mix, like so

lpd://${logged_in_user}@123.45.678/PrintAnywhere

Again, I can't test the above, so I have no idea for sure if that would work, but give it a try and see.

rpayne
Contributor II

Yes they will be. Thank you. I'll get to testing with some scripts built around this

rskolden
New Contributor III

I have been configuring this before and what @mm2270 is suggesting is the way to go.
Just note that your printing system probably read usernames from the AD (if you don't use a local DB), and that means that the local username needs to match the AD username.

So depending on your environment I would say go with one of the following:
- Read local username
- Read AD username from a source that you have available (EC, NoMAD, JC)
- Prompt the user to enter their AD username (I used this for BYOD scenarios)

Chris_Hafner
Valued Contributor II

This is a project that may be on my plate in December. We will pull creds from EC, while prepping for Connect as you are. Glad you folks are already discussing it!

bradtchapman
Valued Contributor

We are a Canon Uniflow shop and our script checks that the printer drivers are installed first (you should not use generic PostScript, but rather Canon's UFR II CUPS drivers). Then it uses a similar technique as @mm2270 to add the printer...

/usr/sbin/lpadmin -p "$lpqueue" -E -v lpd://${username}@${printServer} -m "$printerModel" -o printer-is-shared=false

lpqueue = the printer queue path, like "SecurePrint-Mac"
username = self-explanatory, pulled from local
printServer = the FQDN of the Uniflow print server
printerModel = the path to the print drivers

In this example, documents would be sent for 'bradtchapman' to a Uniflow secure print queue, using the print driver for the Canon ImageRunner Advance C5550, and the 'share printer' option is turned off in the Printers preference pane (reduces Bonjour traffic, prevents excessive duplicates appearing on other Macs)

lpd://bradtchapman@uniflow-la-001.pretendco.com -m "/Library/Printers/PPDs/Contents/Resources/CNMCIRAC5550S2.ppd.gz" -o printer-is-shared false"

Alternatively, if the computer is assigned in Jamf to a user's short name, you can pull the 'username' from the Jamf computer record via API in your script.