Skip to main content

Is there any way to turn off printer sharing via Jamf Pro? In the os, I see two ways one might go about it:




  1. Turn off Printer Sharing in Sharing Settings, or

  2. Uncheck the "Share this printer in the network" box for each of the printers you define.



I have not found a way to do the first, and the second one seems to be turned on by default by the OS.



Hopefully, one or the other is possible!

When we push printer installs we include a command like lpadmin -p PrinterName -o printer-is-shared="False".


That's an interesting idea, and I played around with it. My Printer is named "Office Copier" but when I issue the command:
- lpadmin -p "Office Copier" -o printer-is-shared="False"
I get the error:
- Printer name can only contain printable characters



So in order for this to even have a shot at working I'd need to have weird printer names like Office_Copier, or OfficeCopier.


Run Unix command 'cupsctl --no-share-printers'


I think if you write it as:



lpadmin -p 'Office Copier' -o printer-is-shared="False"
# Or
lpadmin -p Office Copier -o printer-is-shared="False"

# You might also want to look at how the system is saving it as you could edit the generated ppd...
ls /private/etc/cups/ppd


It should work.


@B-35405 You got my hopes up. Sadly, that command seems to have no effect on either global printer sharing, or printer specific sharing. At least if it does all the boxes are still checked in the Sys Pref windows.


Check what the device name is, not just the printer name. For example, we use Server-Dept-Function for the Printer name but the device name in the printer settings on the mac is actually Server_Dept_Function.


This will do it for all printers:



#!/bin/bash

printers=$(lpstat -v | sed 's/://' | awk '{print $3}')

if [[ -n $printers ]]; then
/bin/echo "Printers found..."

for printer in $printers; do
lpadmin -p "$printer" -o printer-is-shared=False
/bin/echo "Disabled printer sharing for $printer."
done

/bin/echo "Restarting CUPS service..."
launchctl stop org.cups.cupsd
launchctl start org.cups.cupsd
/bin/echo "Done"
else
/bin/echo "No printers found, exiting..."
fi

exit 0

Reply