Skip to main content
Question

Extension Attribute to Report Guest Account Status

  • June 29, 2016
  • 3 replies
  • 8 views

Forum|alt.badge.img+5

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

easyedc
Forum|alt.badge.img+16
  • Esteemed Contributor
  • June 29, 2016

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.


Forum|alt.badge.img+5
  • Author
  • Contributor
  • June 29, 2016

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


Forum|alt.badge.img+4
  • Contributor
  • May 15, 2019

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