Created
November 30, 2016 18:56
-
-
Save smashism/e7326a336aa27566de7e5b440fe7bd85 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# NoMAD_LastPasswordExpireDate | |
# Checks NoMAD plist for LastPasswordExpireDate (AD password expiration) | |
# By github.com/smashism | |
# Last modified 2016-11-30 | |
# Provided as-is with no support or warranty | |
loggedInUser=$(python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");') | |
LastPasswordExpireDate=$(defaults read "/Users/$loggedInUser/Library/Preferences/com.trusourcelabs.nomad.plist" LastPasswordExpireDate) | |
if [ "$LastPasswordExpireDate" ]; then | |
echo "<result>$LastPasswordExpireDate</result>" | |
else | |
echo "<result>NoMAD not installed.</result>" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Better to use /usr/bin/python it failed for me without it