Home Forums OS X Server and Client Discussion Questions and Answers Help scripting printer options using lpoptions

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #379036
    jasonkstupski
    Participant

    Hello there,

    I’m trying to script the addition of some printers that will be run as a postflight script on an InstaDMG image. Right now I’m trying to just figure out setting the options. I think I’m doing it correctly, but for some reason the options in System Preferences don’t seem to be sticking. Here’s what I’m trying to do.

    I have a printer called Kermit. I type:

    [code]lpoptions -p Kermit -l[/code]

    And here’s the first few lines of what I get (the option I want to change is in the first lines).

    [code]HPOption_Tray3/Tray 3: *False Tray3_500
    HPOption_Tray4/Tray 4: *False Tray4_500
    HPOption_Tray5/Tray 5: *False Tray5_500
    HPOption_Disk/Printer Disk: *True False
    HPOption_Duplexer/Duplex Unit: *True False[/code]

    I want to set the option for Tray 3 to have a tray of 500 sheets. So I type the following:

    [code]lpoptions -p Kermit -o HPOption_Tray3=Tray3_500[/code]

    Then, when I ask for the settings again using that first line, I get this:

    [code]HPOption_Tray3/Tray 3: False *Tray3_500
    HPOption_Tray4/Tray 4: *False Tray4_500
    HPOption_Tray5/Tray 5: *False Tray5_500
    HPOption_Disk/Printer Disk: *True False
    HPOption_Duplexer/Duplex Unit: *True False[/code]

    The asterisk has moved to “Tray3_500”, suggesting to me that the setting has changed.

    However, when I go into the Options tab under that print queue in systems preferences, it still says “Not Installed.” If I set it from the GUI in System Preferences, it does what I would expect it to on the back end – it moves the asterisk from False to Tray3_500.

    What am I missing here? Any help would be most appreciated.

    Thanks,
    Jason

    #379095
    jasonkstupski
    Participant

    Solved this by not using the lpoptions command and rolling it in at the same time as using the lpadmin command.

    Ended up like this:

    [code]#/usr/sbin/lpadmin -p “Printer Name” -E -v lpd://”xxx.xx.xx.xx”/ -P “ppdlocation.gz” -D “Printer Name” -o printer-is-shared=false -o HPOption_Tray3=Tray3_500 -L “Location”
    [/code]

    Works for me. Couldn’t figure out why using the lpoptions command after the fact didn’t work, but oh well.

    Thanks,
    Jason

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Comments are closed