Re: [Fed-Talk] Applescript for local password expiration
Re: [Fed-Talk] Applescript for local password expiration
- Subject: Re: [Fed-Talk] Applescript for local password expiration
- From: Allister Banks <email@hidden>
- Date: Thu, 13 Dec 2012 16:33:47 -0500
Hey Mr. Kluskens et al,
There is, as you may be aware, a project that's been maintained for several years which specifically accomplishes this for AD.
ADPassMon runs as a 'menulet' and recently gained Notification Center support in 10.8.
Allister Banks
--
318, Inc. -----> Technology. Solutions. Consulting.
Los Angeles | Minneapolis | Nashville | New York | Portland | San Francisco
helping our clients grow profitably through the smart use of technology since 1995
On Thu, Dec 13, 2012 at 3:40 PM, Michael Kluskens
<email@hidden> wrote:
For anyone interested here is an AppleScript to put up a password expiration warning 14 days before a local account expires assuming a 90 day expiration. A slight mod would make this work for ActiveDirectory and Open Directory servers, but there are a number of scripts and programs available to do that.
set lastpwdOD to do shell script "user=`whoami` ; dscl . -readpl /Users/$user PasswordPolicyOptions passwordTimestamp| sed 's/passwordTimestamp: //' "
set y to text 1 thru 4 of (lastpwdOD as text)
set m to text 6 thru 7 of (lastpwdOD as text)
set d to text 9 thru 10 of (lastpwdOD as text)
set lastpwdAS to (m & "/" & d & "/" & y)
set lastpwd to date (lastpwdAS as string)
set changepwd to lastpwd + 90 * days
set daysleft to ((changepwd - (current date)) / days)
set intdaysleft to (daysleft as integer)
if (intdaysleft < 14) then
if (intdaysleft < 1) then
display dialog ("Please change your password immediately")
else
display dialog ("Please change your password soon, you have " & (daysleft as integer) & " days left")
end if
end if
I'm sure this could be fancied up but it does what I need.
Michael
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Fed-talk mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden