Posted on 04-29-2015 08:56 AM
We have a lot of users that enable printer sharing on our corporate printers. And since they show up faster than the directory listed one, it creates a lot of tickets.
i saw a couple JN posts on it and I kind of combined the EA and the disable script to our solution, however, it doesn't seem to work right.
I setup this EA and scoped to a smart group
and this script to disable it.
I setup the EA and tested by enabling and disabling printer sharing and it worked.
When I added the script to it, and enabled update inventory it never dropped out of the EA/SG. I verified that it does in fact disable the sharing though. So I added a jamf recon to the script and it still didn't drop out of the SG.
But when I disable it manually and then run a recon it drops out of the group.
Posted on 04-29-2015 09:21 AM
Scratch what I posted. . .
Posted on 04-29-2015 09:58 AM
well, technically it worked. it remains shared, but turns off printer sharing and the EA properly reports it's off and drops the SG.
Did you find it did something further?
Posted on 04-29-2015 10:32 AM
I have not found anything else. I had misread the last part of your post, so I didn't think my answer was useful.
I use the EA link you posted and then the script below to disable printer sharing. Have not had any problems with it.
#!/bin/sh
cupsctl --no-share-printers
exit 0
Posted on 04-29-2015 10:43 AM
We use the following to remove check from the "Share this printer..." on each printer. This is more for appearance as we disable printer sharing system wide, but the JSS loves to default each printer to having the box checked (whyyyyyy):
lpstat -p | grep printer | cut -d" " -f2 | xargs -I {} lpadmin -p {} -o printer-is-shared=False
Posted on 04-29-2015 10:56 AM
I turned it into an active EA
#!/bin/sh
# Displays the status of printer sharing
printerSharingStatus=`cupsctl | grep "_share_printers=" | sed 's/_share_printers=//g'`
if [ $printerSharingStatus == 1 ]; then
/usr/sbin/cupsctl --no-share-printers
/usr/sbin/lpadmin -p ALL -o printer-is-shared="False"
echo "<result>Disabled</result>"
else
echo "<result>Disabled</result>"
fi
Posted on 04-29-2015 12:19 PM
The GUI is probably doing something additional to the printers.
Since your EA is polling cupsctl, which queries cupsd.conf, you might just need to reload the service.
You could try this at the end of your script:
launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist
launchctl load /System/Library/LaunchDaemons/org.cups.cupsd.plist
Posted on 05-15-2018 01:08 PM
This is brilliant...However what is the best way to check if a system has any printers shared, at the printer level? Currently you're looking up the Global Printer Share setting =0/1. I want to run this on systems that might have the global OFF, but individual printers ON.
Is there a quick and dirty way to modify this to capture both groups inside your active EA?
Also, I found that this:
/usr/sbin/lpadmin -p ALL -o printer-is-shared="False"
Didn't work, but this (from above) did:
lpstat -p | grep printer | cut -d" " -f2 | xargs -I {} lpadmin -p {} -o printer-is-shared=False
To actually remove ALL checkboxes from every shared printer at the printer level.....
Any help would be appreciated.
Thanks,