Self Service 9.72 Issue

mpermann
Valued Contributor II

We just upgraded to JSS 9.72 yesterday and ran into an issue with Self Service. We previously were on 9.63 and didn't experience this issue. We have Self Service policies setup that use the lpadmin command in the execute command box in Files and Processes to install printers. Since upgrading to 9.72 these policies don't work anymore. If I execute the lpadmin command

lpadmin -p "Johnston_Printer_51708" -v "lpd://xxx.xx.xxx.xxx/" -D "Johnston Printer 51708" -L "Johnston Office" -P "/Library/Printers/PPDs/Contents/Resources/HP LaserJet P4010_P4510 Series.gz" -E -o printer-is-shared=false -o HPOption_Tray3=Tray3_500 -o HPOption_Duplexer=True

from a terminal shell though it works just fine. Has anyone else experienced this issue with Self Service in 9.72?

2 ACCEPTED SOLUTIONS

freddie_cox
Contributor III

Give this a shot.

/usr/sbin/lpadmin -p Johnston_Printer_51708 -v lpd://XX.X.X.XX/ -D 'Johnston Printer 51708' -L 'Johnston Office' -P /Library/Printers/PPDs/Contents/Resources/HP LaserJet P4010_P4510 Series.gz -E -o printer-is-shared=false -o HPOption_Tray3=Tray3_500 -o HPOption_Duplexer=True

It looks like it was an issue with escaping the spaces. I switched your quotes to single quotes "'" not """ and used backslashes "" for the file system path.

When I ran the policy I was getting the following error:

bash-3.2# jamf policy -trigger printtest -verbose
 verbose: Checking for an existing instance of this application...
Checking for policies triggered by "printtest"...
 verbose: Checking for active ethernet connection...
 verbose: Active ethernet connection found...
 verbose: The Management Framework Settings are up to date.
 verbose: Found 1 matching policies.
 verbose: Removing any cached policies for this trigger.
 verbose: Parsing servers...
 verbose: Parsing Policy PrinterTest (497)...
 verbose: Parsing Policy PrinterTest (497)...
Executing Policy PrinterTest...
    Running command lpadmin -p "Johnston_Printer_51708" -v "lpd://XX.X.X.XX/" -D "Johnston Printer 51708" -L "Johnston Office" -P /Library/Printers/PPDs/Contents/Resources/HP LaserJet P4010_P4510 Series.gz -E -o printer-is-shared=false -o HPOption_Tray3=Tray3_500 -o HPOption_Duplexer=True...
    Result of command:
lpadmin: Unknown argument "Printer".

Once I made those changes, it ran as expected. Let me know how it goes!

View solution in original post

mpermann
Valued Contributor II

@freddie.cox I heard from JAMF earlier but didn't have a chance to update the thread. They confirmed there is a defect (D-008699) where commands that use double-quotes aren't executing properly. They indicated the fix will not make it into 9.73 but will most likely will be included in the following release. It was suggested by JAMF to remove the double-quotes and then the command would complete. I changed all the double to single quotes and the commands are executing normally now. I didn't need to escape the spaces in the path to the ppd if there were single quotes surrounding the path. Without the single quotes, it was necessary to escape the spaces though. Thanks for the time you spent to help with the issue.

View solution in original post

7 REPLIES 7

mpermann
Valued Contributor II

A little update on this issue, I found that if I create a script with the lpadmin command then create a policy that executes that script the printer creation works fine. I've reported the behavior to my TAM and will report back what he says. I'm wondering if there are other commands that used to work fine from the execute command box in the Files and Processes section that also fail now. If anyone else is able to replicate this behavior please post your results.

freddie_cox
Contributor III

Have you tried it with the full command path?

/usr/sbin/lpadmin

Not sure if it will make a difference, but sometimes the PATH variable is a bit different when running scripts and it's considered a good idea to always use the absolute path for any commands to make sure you don't run into issues like this when running under a different context.

If you don't know the absolute path, you can find it by using the "which" command:

ComputerName:~ username$ which lpadmin
/usr/sbin/lpadmin

mpermann
Valued Contributor II

@freddie.cox, I just created a modified policy that uses the full path to lpadmin as you suggested and it didn't help. I'm curious if it worked for you and if it did what version of the JSS you are using?

freddie_cox
Contributor III

Give this a shot.

/usr/sbin/lpadmin -p Johnston_Printer_51708 -v lpd://XX.X.X.XX/ -D 'Johnston Printer 51708' -L 'Johnston Office' -P /Library/Printers/PPDs/Contents/Resources/HP LaserJet P4010_P4510 Series.gz -E -o printer-is-shared=false -o HPOption_Tray3=Tray3_500 -o HPOption_Duplexer=True

It looks like it was an issue with escaping the spaces. I switched your quotes to single quotes "'" not """ and used backslashes "" for the file system path.

When I ran the policy I was getting the following error:

bash-3.2# jamf policy -trigger printtest -verbose
 verbose: Checking for an existing instance of this application...
Checking for policies triggered by "printtest"...
 verbose: Checking for active ethernet connection...
 verbose: Active ethernet connection found...
 verbose: The Management Framework Settings are up to date.
 verbose: Found 1 matching policies.
 verbose: Removing any cached policies for this trigger.
 verbose: Parsing servers...
 verbose: Parsing Policy PrinterTest (497)...
 verbose: Parsing Policy PrinterTest (497)...
Executing Policy PrinterTest...
    Running command lpadmin -p "Johnston_Printer_51708" -v "lpd://XX.X.X.XX/" -D "Johnston Printer 51708" -L "Johnston Office" -P /Library/Printers/PPDs/Contents/Resources/HP LaserJet P4010_P4510 Series.gz -E -o printer-is-shared=false -o HPOption_Tray3=Tray3_500 -o HPOption_Duplexer=True...
    Result of command:
lpadmin: Unknown argument "Printer".

Once I made those changes, it ran as expected. Let me know how it goes!

mpermann
Valued Contributor II

@freddie.cox I heard from JAMF earlier but didn't have a chance to update the thread. They confirmed there is a defect (D-008699) where commands that use double-quotes aren't executing properly. They indicated the fix will not make it into 9.73 but will most likely will be included in the following release. It was suggested by JAMF to remove the double-quotes and then the command would complete. I changed all the double to single quotes and the commands are executing normally now. I didn't need to escape the spaces in the path to the ppd if there were single quotes surrounding the path. Without the single quotes, it was necessary to escape the spaces though. Thanks for the time you spent to help with the issue.

freddie_cox
Contributor III

Glad you were able to get it resolved, thanks for the update!

Chris_Hafner
Valued Contributor II

Funny, I only just started doing this and figured I had my syntax improperly written ;-)