What's wrong with this script in Mavericks?

obi-k
Valued Contributor III

Hello,

The script below works in Mountain Lion, but not Mavericks. We put this code into Automator as "Run Shell Script" and save it as an app. Users would double-click it to add printers. In Mavericks, it adds but when they print, it prints out garble.

Thinking it is driver. Is the code below broken in Mavericks?

****

PrinterName='Thomas - Guidance Main HP 4015'
CUPSPort='Tho_154_73'
Driver='HP LaserJet P4010_P4510 Series.gz'

/usr/sbin/lpadmin -p $CUPSPort -E -v http://printexample.com/printers/$CUPSPort -P "/Volumes/example/public/Printer Install/DriversOSX/$Driver" -D "$PrinterName" -o printer-is-shared=false

1 ACCEPTED SOLUTION

obi-k
Valued Contributor III

So far fixed. We updated the Automator script to:

****
PrinterName='Example - Acorn'
CUPSPort='EXM_247_55'
Driver='HP LaserJet P3005.gz'

/usr/sbin/lpadmin -p $CUPSPort -E -v http://Example.com/printers/$CUPSPort?compression=none -P "/Volumes/common/public/Printer Install/DriversOSX/$Driver" -D "$PrinterName" -o printer-is-shared=false

***

The difference is the "?compression=none" portion. Mavericks and CUPS 1.4 has issues. When you update the code, Mavericks/Mountain Lion users are good. No garble text!

https://discussions.apple.com/thread/5505965?tstart=0

View solution in original post

8 REPLIES 8

musat
Contributor III

I can't say for sure, bu we found that Mavericks had issues with out printers that had spaces in the names. We were renaming all of our printers for a different reason, so we just made sure to eliminate all spaces from the names, and all is working better now.

ewu-it
New Contributor III

With just having taken a quick look, it looks like the Mavericks version of lpadmin does not have the -E switch anymore. While the man page still reflects it being there, if you open Terminal and try ```
lpadmin -help
``` the -E switch is not present.

I would check to see if the Printer entry is in fact getting set up properly to use the HP driver and not the Generic Postscript designation. I have seen a few HP printers that print junk as you are describing when the "driver" is set to the Generic Postscript.

--
Howard Griffith--Endpoint Systems Engineer--Eastern Washington University

obi-k
Valued Contributor III

Thanks so much for the responses.

Do you think it might be due to SMB and SMB2 issues? In my first script, which is an apple script that launches a NFS share point for the users, I have it down as SMB.

****
So example:

tell application "Finder" mount volume "smb://example.id.add.us/common"
end tell
tell application "Finder" open location "smb://example.id.add.us/common/public/Printer%20Install/APS%20Mac%20Printer%20Installers"
end tell

***
I was going to try CIFS instead of SMB. Worth a shot? I've heard of some weird behavior with SMB/Mavericks.

stevewood
Honored Contributor II
Honored Contributor II

Why not leverage your JSS to do the install of the driver? I'm assuming that is the purpose of your -P portion of the lpadmin command. Instead of trying to do this as an Automator app, why not use Self Service and install the appropriate driver and then the printer?

Or, if you cannot use Self Service in your environment, create a policy for each printer driver you need added to the systems, and then call the appropriate policy in the Automator app. For example, if I had a policy in my JSS that installed the HP 4010 driver like in your example, and that policy had an ID of 300, I'd write my printer script like this:

PrinterName='Thomas - Guidance Main HP 4015'
CUPSPort='Tho_154_73'

/usr/sbin/jamf policy -id 300

/usr/sbin/lpadmin -p $CUPSPort -E -v http://printexample.com/printers/$CUPSPort -P "/Library/Printers/PPDs/$Driver" -D "$PrinterName" -o printer-is-shared=false

Of course you'd need to verify the location on the local machine for where the driver lives, but something like that should work.

Oh, and I too have seen issues with spaces in the names of our printers when using lpadmin to add them. I took the spaces out. And the -E switch is available under Mavericks, or at least it is in the man page for lpadmin.

bentoms
Release Candidate Programs Tester

This all looks really similar to what we do, works well...

http://macmule.com/2011/09/08/how-to-map-drives-printers-based-on-ad-group-membership-on-osx/

As for the printing issue, are you sure it's the correct driver for that printer & 10.9? Perhaps the printer needs an update?

obi-k
Valued Contributor III

Hi Steve Wood,

I would love nothing more than to add these printers into our JSS/Self Service. We're talking over 500 printers for 32 schools (not including admin offices). We have an old set up now that worked with 10.8 -- so trying to leverage that.

I just tried the CIFS thing, but that didn't work. I will try to eliminate the spaces in the names next.

Thanks again for your guys input.

bentoms
Release Candidate Programs Tester

Remove the %20 & just use a space if using an AppleScript.

Also, you maybe able to run the mount command to the folder. Maybe..

obi-k
Valued Contributor III

So far fixed. We updated the Automator script to:

****
PrinterName='Example - Acorn'
CUPSPort='EXM_247_55'
Driver='HP LaserJet P3005.gz'

/usr/sbin/lpadmin -p $CUPSPort -E -v http://Example.com/printers/$CUPSPort?compression=none -P "/Volumes/common/public/Printer Install/DriversOSX/$Driver" -D "$PrinterName" -o printer-is-shared=false

***

The difference is the "?compression=none" portion. Mavericks and CUPS 1.4 has issues. When you update the code, Mavericks/Mountain Lion users are good. No garble text!

https://discussions.apple.com/thread/5505965?tstart=0