UNCHECK share this printer on the network

tcandela
Valued Contributor II

printers deployed via policy (Self Service) have the 'share this printer on the network' CHECKED. How do I get this to deploy UN-CHECKED ?
The printer is being uploaded UN-checked, .

1 ACCEPTED SOLUTION

May
Contributor III

I've been using the Files and Processes section in the same policy that adds the printer, no issues so far

Execute Command lpadmin -p YOURPRINTERNAME -o printer-is-shared=false

View solution in original post

8 REPLIES 8

davidacland
Honored Contributor II

Hi,

There's a bunch of suggestions and examples on this thread: https://jamfnation.jamfsoftware.com/discussion.html?id=11050

tcandela
Valued Contributor II

davidacland - also, the printers that get added by policy have 'share this printer on the network' CHECKED but the computers have 'Printer Sharing is turned OFF, but i would like to have the printers UN-Checked

im not really great at scripting, so I did some cut and paste (from the settimezone script and created a script.sh. In the policy I added the script with priority 15 'After', the setting for the parameter is My printer name (printer name has spaces, i used no quotes when adding the printer name in the scripts parameter section of the policy )

here is the script

#!/bin/bash
# A HARDCODED VALUE FOR "Printer_Name" CAN BE SET BELOW.
# A list of accepted time zone values can be generated using the following command in Terminal:
#
# This script disables printer sharing on a designated printer.
# Delete the double quotes and replace with the desired printer_name,
# If this script is to be deployed via policy using the JSS leave the next line as is.

printer_name=""
lpadmin -p "$printer_name" -o printer-is-shared=false
echo "Print Sharing for $printer_name has been disabled."
exit 0

May
Contributor III

I've been using the Files and Processes section in the same policy that adds the printer, no issues so far

Execute Command lpadmin -p YOURPRINTERNAME -o printer-is-shared=false

tcandela
Valued Contributor II

@May - my Files and Processes is not working. The printer name has spaces, so would I have to put the printer name in " " ? Ex. " Mathlab-sharp mx-c311"

lpadmin -p "Mathlab-sharp mc-c311" -o printer-is-shared=false

tcandela
Valued Contributor II

Or. Mathlab-sharp_mc-c311

tcandela
Valued Contributor II

based on lpstat -p I would have to name it Mathlab_sharp_mc_c311

May
Contributor III

@tcandela ah, i remember that now! i was fortunate enough to be able to rename the printer so it had no spaces.
Did you test with the quotes?

tcandela
Valued Contributor II

when i tested with quotes from command line I was getting things like 'command not found' 'the printer uri must be of form pip://HOSTNAME/printers/PRINTERNAME echo 'message'

once I changed it to Mathlab_sharp_mc_c311 it went directly to the echo 'message' I checked system preferences and printer sharing was Unchecked

I have not tested via Casper yet, I will run a 'self service' printer install soon, i put that lpadmin -p .............. in the policies Files and Processes section