Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Show days left until Active Directory password expires' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Show days left until Active Directory password expires
Authored by: joelbruner on Dec 15, '10 08:57:07AM
Snow Leopard's dscl prepends dsAttrTypeNative: to lastpwdMS: this fixes the match so output is purely numeric:
lastpwdMS=`echo "$userRecord" | grep -i pwdLastSet | sed 's/dsAttrTypeNative:pwdLastSet: //'`

Although, this is better and might in some way future-proof it by using the space as a delimeter in cut :
lastpwdMS=`echo "$userRecord" | grep -i pwdLastSet | cut -d' ' -f 2`

[ Reply to This | # ]