Skip to content

Instantly share code, notes, and snippets.

@jps3
Last active December 16, 2020 19:28
Show Gist options
  • Save jps3/fe817bb567333ac23579bd5f860618cc to your computer and use it in GitHub Desktop.
Save jps3/fe817bb567333ac23579bd5f860618cc to your computer and use it in GitHub Desktop.
Jamf 200 - Section 3 - Lesson 13 - Task 2 - Computer Extension Attribute
#!/bin/bash
#
# Checks whether Guest account is enabled and echoes status in
# Jamf Computer Extension Attribute format.
#
# Will return Enabled or Disabled.
#
PATH=/usr/bin
guestEnabled="$(defaults read /Library/Preferences/com.apple.loginwindow.plist GuestEnabled 2>/dev/null)"
result=""
if [[ "${guestEnabled}" == "1" ]]; then
result="Guest Enabled"
else
result="Guest is NOT Enabled"
fi
echo "<result>${result}</result>"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment