Extension Attribute to Report Guest Account Status

ksanborn
New Contributor III

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.

3 REPLIES 3

easyedc
Valued Contributor II

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.

ksanborn
New Contributor III

Figured it out. I used the following script:

!/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

jonathan_mcc
New Contributor III

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