Posted on 06-30-2014 07:48 AM
There was a post i saw from 2012 that mentioned you could disable Printer Sharing with "cupsctl --no-share-printers"
That doesn't really uncheck and grey out the "Printer Sharing" service though. Is there a way to lock it down? Internet Sharing was easy enough with com.apple.nat
Posted on 06-30-2014 09:30 AM
I use the cupsctl method, but I also install all our printers via a script and set the sharing option to off during that process as well.
Posted on 01-20-2015 10:16 AM
What does that script look like? @geoffrey-obrien
Posted on 01-22-2015 12:52 AM
@KCH080208, just stumbled over a post by @qsodji on his blog on how to do this: https://jumpt.wordpress.com/2014/09/10/disable-printer-sharing-when-deploying-printers-via-casper/
Posted on 01-22-2015 04:34 AM
I've got a script that I use to disable printer sharing for individual printers after they've been set up. It's available from here on my Github repo:
Posted on 01-22-2015 10:26 AM
This will disable sharing on all currently installed printers. Not just known/named ones.
https://gist.github.com/rmanly/bf28847ddec8e3f0bd03
#!/bin/bash
while read -r _ _ printer _; do
/usr/sbin/lpadmin -p "${printer/:}" -o printer-is-shared=false
done < <(/usr/bin/lpstat -v)
Posted on 02-19-2015 12:20 PM
To implement this in Casper it says to use the Files and Processes option when making a policy
The last option within Files and Processes is Execute command, so you would paste the command into the field and once your printer is installed, the command will execute and remove the sharing on that printer only.
lpadmin -p <printer_name> -o printer-is-shared=false
would I need to put the <printer_name> in quotes "MY Printer is"
Posted on 02-19-2015 12:25 PM
@tcandela - generally speaking when talking about unix commands, its a good idea to quote strings, especially if there are spaces in them. If your printer name has spaces in it then definitely enclose it in quote marks.
Posted on 02-19-2015 12:33 PM
I am going to stick the command in the Files and Processes Execute section, here is the command
my printer name has spaces
lpadmin -p "My Printer name" -o printer-is-shared=false
If i wanted to use this in a script instead, what priority would i use ?
In Casper Admin I have a 'Script' category set at 15, priority 'After'
#!/bin/bash
# A HARDCODED VALUE FOR "Printer_Name" CAN BE SET BELOW.
#
# Delete the double quotes and replace with the desired printer_name,
# This script disables printer sharing on a designated printer.
# If this script is to be deployed via policy using the JSS leave the next line as is.
printer_name="$4"
lpadmin -p "$printer_name" -o printer-is-shared=false
echo "Print Sharing for $printer_name has been disabled."
exit 0
Posted on 02-19-2015 01:00 PM
@tcandela - A Category's priority has no bearing on how the script or package will run when its in that category. It only affects where the Category label shows up within Self Service.
Posted on 02-20-2015 09:46 AM
when the script runs via Casper, were does the echo "message" get displayed? or is it just ignored?
when i run the script from the command line, i see the echo 'message' in the terminal
Posted on 03-02-2015 11:52 AM
when the script runs via Casper, were does the echo "message" get displayed? or is it just ignored?
You'll see it in the logs on the JSS.
Posted on 02-13-2019 09:32 AM
These solutions all disable sharing, at the printer level. I believe the OP wanted to know how to Disable (and gray out) the Printer Sharing checkbox in the Sharing Preference Pane.
Posted on 04-02-2019 02:01 AM
Hello, @JayDuff Your suggestion is indeed something I am actually trying to find. Do you or anybody have a clue ? I have though about disabling the general printer sharing options and then hiding the "sharing" section from the preference panel but not so happy with that solution...
Posted on 04-02-2019 05:38 AM
@fdeltesta Sorry - what's here is the best I found.