Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Secure Token Users Extension Attribute
# originally written by @franton
osvers_major=$(/usr/bin/sw_vers -productVersion | awk -F. '{print $1}')
osvers_minor=$(/usr/bin/sw_vers -productVersion | awk -F. '{print $2}')
osvers_dot_version=$(/usr/bin/sw_vers -productVersion | awk -F. '{print $3}')
if [[ "$osvers_major" -eq 10 && "$osvers_minor" -lt 13 ]]; then
echo "<result>Older macOS version</result>"
users=($( dscl . -list /Users | grep -Ev '(_|daemon|nobody|root)' ))
for (( loop=0; loop<${#users[@]}; loop++ ));
result=( "${result[@]}" $( sysadminctl -secureTokenStatus ${users[$loop]} 2>&1 | awk -v user="${users[$loop]}" '{if ($7=="ENABLED") print user}' ) )
[ ${#result[@]} = "0" ] && echo "<result>No users have a Secure Token</result>" || echo "<result>${result[@]}</result>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment