Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save manicmachine/661df715ab20453636f840ccde7014f7 to your computer and use it in GitHub Desktop.

Select an option

Save manicmachine/661df715ab20453636f840ccde7014f7 to your computer and use it in GitHub Desktop.
Jamf Pro EA: Management Account Password Last Set
#!/bin/bash
account="laps_account" # replace this with the account you wish to track
passwordLastSetTimeEpoch=$(/usr/bin/dscl . read "/Users/$account" accountPolicyData | /usr/bin/awk -F'[><]' '/<key>passwordLastSetTime<\/key>/{getline; print $3}' | /usr/bin/cut -d '.' -f1)
# Time in UTC -- use `date -jf` if you want the time in local timezone instead
echo "<result>$(/bin/date -juf %s "$passwordLastSetTimeEpoch")</result>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment