Posted on 09-25-2013 01:22 PM
So we are building our printers using Casper Admin and deploying them via self service. All is working fine, printers install (canon iR advanced series copiers to be exact), print, all of the feature sets show up correctly...
Except...
When the copier shows up, it is set as shared. User has to manually uncheck the "Share the printer" option.
Shouldn't be a big deal since we typically turn off printer sharing by default. But if someone turns it on, it could get weird. Anyone seen this? Any idea why this is happening?
Posted on 09-25-2013 01:59 PM
I have the same problem when adding printers using a policy. What's weird is that for me, the sharing checkbox is checked, but it says under the checkbox that printer sharing is off.
Posted on 09-25-2013 03:20 PM
Todd,
Yes, because you probably have printer sharing turned off globally (as we do) under Sharing. So... If that ever gets turned on, all the printers would be shared. Messy.
Posted on 09-25-2013 11:36 PM
How about adding a printer via a script? That way you get it just like you want it ;)
Posted on 09-26-2013 05:45 AM
We've had good luck with scripts, but the Canon option set gets pretty complex. Besides, if we wanted to do everything with a script, we would have never purchased Casper Suite in the first place. :)
Posted on 09-26-2013 05:52 AM
Yep, we see the same thing. Sharing is enabled by default but it's off globally for us. It's really just annoying and that's about it for us. It would be a great feature request though. This is the type of thing JAMF is good at!
Posted on 09-26-2013 05:53 AM
Not a fan of adding printers to Casper Admin, rather use scripts to configure (scoped to Macs that have the correct drivers installed; else driver PKG would be part of the policy along with the script).
To ensure the printer is added with sharing set to disabled, we add:
-o printer-is-shared="False"
Don
Posted on 09-26-2013 05:55 AM
Don,
Do you have some example scripts that you'd be willing to share? Maybe we need to just get better with our scripting, but we don't have a lot of confidence in doing that right.
Thanks!
Posted on 09-26-2013 06:50 AM
318 Tech Journal has a good article that covers this:
http://techjournal.318.com/tag/lpoptions/
Take a look at these man pages too:
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/lpadmin.8.html
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/lpoptions.1.htm...
The easiest way to wrap your head around this is to:
1. Start with a test Mac, reset printing system (er, make sure Printer Sharing is disabled too <wink>).
http://support.apple.com/kb/HT1341
Manually add a printer, make sure all options are properly set (trays, duplex, features, yadayada).
Run this command for a short list of enabled features:
lpoptions
Run this command to get the full list of possible options, note the enabled options have "*":
lpoptions -list
Then mesh what you get in step 4 with the above article...
Note some high end printers that have Fiery/Creo tend to host the PPD on the RIP, this way the provider can edit the PPD (trust me, many printers that are deployed lack lpoptions options because of bad PPDs) and you can curl it to be used when configuring the printer on the Mac. If you have these kinds of Fiery/Creo printers, work with your provider to make sure you're using the right PPD from the right place. ;)
Lastly, remember if you are going to push printers, make sure the correct driver is installed. For OSX-bundled drivers, fine, for Fiery/Creo drivers, scope carefully... :)
Don
Posted on 09-26-2013 12:10 PM
Besides @talkingmoose's article on 318 TechJournal, there's also http://hints.macworld.com/article.php?story=20120313110411984 which has more details and a useful script to determine what printer options (different from the defaults) must be configured from the command line. It's very helpful.
Posted on 09-27-2013 07:53 AM
I use variable and call on them in the main part of the script.
Example below:
#!/bin/bash
##############################################################################################################
#
# Created By Tim Kimpton
#
# 21/5/2013
#
# Version 1.2
#
# This is used to
#
# 1. Remove the printer if installed
#
# 2. Add the printer
#
# 3. Enabled any disabled printers
#
#############################################################################################################
########################################### ENVIRONMENT VARIABLES ###########################################
############ Server ############
# Server
Server=XXX
############ Printer Name ############
# Library printer
printer=XXX
############ Printer Ports ############
# Port
port=lpd
############ Printer Location ############
# Printer Location
Location="XXX"
######### Printer Drivers ############
# PPD
PPD=XXX
########### Printer Default Options #######
# Not shared
NShared="-o printer-is-shared=false"
# Doublesided / Duplex
Duplex="-o EFDuplex=TopTop"
# Grayscale
Gray="-o EFColorMode=Grayscale"
# Recyled Paper
Recycled="-o EFMediaType=Recycled"
######## Status ##########
# Define a disabled printer
DisabledP=`lpstat -p | grep "disabled" | awk '{print $2}'`
# Define the printer to remove
remove=`lpstat -p | grep "$printer" | awk '{print $2}'`
######################################### DO NOT MODIFY BELOW THIS LINE ######################################
# Remove the printer
/usr/sbin/lpadmin -x "${remove}"
if [ -f "$PPD" ] ;then
/usr/sbin/lpadmin -p $Server-$printer -E -v $port://$Server/$printer -P "$PPD" -D "$Server-$printer" -L "$Location" $NShared $Duplex $Gray
else echo "Driver Missing"
fi
# Clear all print queues
cancel -a
# Enable any disabled printers
cupsenable $DisabledP
exit 0
Posted on 02-13-2014 10:26 AM
I just wanted to update this thread by letting you all know this is still an issue in 9.23. Looks like it's scripted printers for me. ```
cupsctl --no-share-printers
``` seems to work just doesn't uncheck the boxes in the GUI.
Posted on 02-20-2014 10:49 AM
CUPS can share printers via mDNS (Bonjour), but each individual printer can toggle to be visible or not when CUPS broadcasting is going on.
cupsctl --no-share-printers
turns off all printer sharing at the CUPS level.
If you get super picky (like myself and seems like others), then you can turn off individual printer sharing with:
lpadmin -p PRINTERNAME -o printer-is-shared="False"
Where PRINTERNAME is the queue you want to turn off.
If you want to disable individual sharing on all installed printers (which updates the GUI):
lpadmin -p ALL -o printer-is-shared="False"
Posted on 05-05-2014 05:32 PM
These commands work in 10.9 but not in 10.8 for me, anyone else having the same issues?
I'd like to use cupsctl --no-share-printers and lpadmin -p ALL -o printer-is-shared="False" but nothing happens, anyone else having the same issue or is it just our MOE?
Posted on 05-06-2014 08:24 AM
Frank,
My machine was on OS X 10.9 when I tested the cupsctl and lpadmin commands, but I have high confidence that these commands will also work in OS X 10.8.
Posted on 05-31-2014 04:50 PM
I did some testing with a 10.9.3 client ...
cupsctl --no-share-printers
This didn't deselect the "Share this printer on the network" GUI selection for a given printer, but the change was represented just below with yellow caution symbol/"Printer sharing is turned off."
lpadmin -p ALL -o printer-is-shared="False"
I couldn't get this to work, but didn't spend too much time with it. Dunno.
lpadmin -p PRINTERNAME -o printer-is-shared="False"
This works fine for me though.
Ultimately, the following appears to be an option to disable sharing on all printers:
lpstat -p | grep printer | cut -d" " -f2 | xargs -I {} lpadmin -p {} -o printer-is-shared=False
Borrowed from:
http://jamauai.com/2014/02/25/how-to-manage-printers-via-command-line/
Posted on 02-16-2015 11:46 AM
Thanks CGundersen for the helpful code:
lpstat -p | grep printer | cut -d" " -f2 | xargs -I {} lpadmin -p {} -o printer-is-shared=False
This command worked for all but one of the printers we are working with here. This lead me to the realization that in order for the changes to be made, the printer name must not contain spaces. Grabbing the printer name with the -f2 flag would only grab the first portion of the name.
For instance, we have a printer called LaserJet P4515_Pharos. When attempting to get the printer name with the first portion of the command:
lpstat -p | grep printer | cut -d" " -f2
it would only grab "LaserJet" as the name and therefore would be an invalid printer.
Renaming the printer to "LaserJet_P4515_Pharos" without spaces would allow the printer settings to be changed.
Posted on 05-19-2015 11:25 PM
Tested on a 10.10.2 client and this string when run for the terminal did what was expected:
lpadmin -p ALL -o printer-is-shared="False"
Disabled the individual sharing on all installed printers (and updated the GUI).
Added this string to a pushed policy to clients in the Files and Processes ->
Files and Processes
Configured
Section under ->
Execute Command
Command to execute on computers. This command is executed as the "root" user
Will test via self service on a client to see if it works from the policy, but can't see any reason why it won't.