Posted on 12-12-2014 06:29 AM
Looking for an Extension Attribute to determine if a Mac has Sharing > Printer Sharing is checked.
Current Process:
We currently send this command using Casper Remote to individual computers when needed to turn off printer sharing. We could create a policy to run this each week but are looking for something more automated.
[cupsctl --no-share-printers]
Ideal Process:
Have an Extension Attribute which identifies computers that have Printer Sharing checked and add this device to a Smart Computer Group. A policy would be created scoped to this smart group which would run the command [cupsctl --no-share-printers] under Files and Processes.
Any suggestions are appreciated?
Thank you,
Karl Senger
Systems Engineer
School District of Milton
Milton, WI
Solved! Go to Solution.
Posted on 12-12-2014 06:52 AM
Using cupsctl this should do the job:
#!/bin/sh
printerSharingStatus=`cupsctl | grep "_share_printers=" | sed 's/_share_printers=//g'`
if [ $printerSharingStatus == 0 ]; then
echo "<result>Disabled</result>"
else
echo "<result>Enabled</result>"
fi
exit 0
Call it something like "Printer Sharing Status" and it will say whether it is enabled or disabled.
Posted on 12-12-2014 06:52 AM
Using cupsctl this should do the job:
#!/bin/sh
printerSharingStatus=`cupsctl | grep "_share_printers=" | sed 's/_share_printers=//g'`
if [ $printerSharingStatus == 0 ]; then
echo "<result>Disabled</result>"
else
echo "<result>Enabled</result>"
fi
exit 0
Call it something like "Printer Sharing Status" and it will say whether it is enabled or disabled.
Posted on 12-12-2014 06:59 AM
Another possible way is to look for "Browsing On" or "Browsing Off" in the cupsd.conf file.
#!/bin/sh
echo "<result>$(awk '/Browsing/{print $2}' /private/etc/cups/cupsd.conf)</result>"
It should report "On" or "Off"
EDIT- Never mind the above. Looks like that may only show if the general printer sharing option is enabled, but not whether any printers are actually checked to be shared out. It may also report as On if the machine is connected to someone elses remotely shared printer, so false positives.
Use what davidacland posted above instead.
Posted on 12-17-2014 01:29 PM
This script as an Extension Attribute worked perfectly.
Extension Attribute used as the criteria in a Smart Computer Group.
Policy scoped to this Smart Computer group, with this "Execute Command"
"cupsctl --no-share-printers; sudo jamf recon"
The computer falls right out of the Smart Computer group.
Posted on 01-20-2015 10:22 AM
@sengerk i was just looking into this. What does this look like in the JSS? Did you use @davidacland script or how did you put the script as an extension attribute?
Posted on 01-20-2015 11:05 AM
nevermind i got it all figured out. Thanks for the helpful information.