Posted on 06-29-2016 05:55 AM
I found an extension attribute on the JAMF Extension Attribute site but it doesn't work as I would expect it to, probably because we aren't using Managed Preferences. We would like to be able to report back if the guest account is enabled or disabled, in an extension attribute. I thought this would be fairly easy but can't find a solution on JAMF Nation and via Internet Searches. Any help is appreciated.
Posted on 06-29-2016 07:58 AM
So can you not create a smart group with the criteria of the local user account and have it notify you? That's what I would do.
Posted on 06-29-2016 08:27 AM
Figured it out. I used the following script:
result=/usr/bin/defaults read /Library/Preferences/com.apple.loginwindow.plist GuestEnabled
if [ "$result" == "0" ]; then
echo "<result>Disabled</result>"
else
echo "<result>Enabled</result>"
fi
Posted on 05-14-2019 10:15 PM
Just in case anyone see's this many years after and tries the script...it needs a few adjustments.
Adjust the line: result=/usr/bin/defaults read /Library/Preferences/com.apple.loginwindow.plist GuestEnabled
You need to surround it with $()
to get the result
Final Script being:
#!/bin/sh
result=$(/usr/bin/defaults read /Library/Preferences/com.apple.loginwindow.plist GuestEnabled)
if [ "$result" == "0" ]; then echo "<result>Disabled</result>"
else echo "<result>Enabled</result>"
fi