Break On
Dim $, $colItems, $objItem
Dim $Filter[0]
$ = SetOption('explicit', 'Off')
$ = SetOption('WrapAtEOL', 'On')
$ = SetOption('NoVarsInStrings', 'On')
$ = SetOption('NoMacrosInStrings', 'On')
$UserID = '%USERDOMAIN%/%USERNAME%'
;=============================================================================================
; The following two UDFs need to be downloaded and either called or placed into the script
Call '%KixLibPath%\TimeConvert.kxf'
Call '%KixLibPath%\TimeDiff.kxf'
;=============================================================================================
Dim $objUser, $ary_DATA[13], $Tmp
$objUser = getobject('WinNT://' + $UserID + ',user')
@SERROR ?
If $objUser
$ary_Data[5] = $objUser.LastLogin ; Last login date
$ary_Data[6] = $objUser.BadLoginCount ; # bad logins
$ary_Data[7] = $objUser.BadLoginAddress ; Last bad login from
$ary_Data[8] = $objUser.PasswordAge ; seconds since last pw change
$ary_Data[9] = $objUser.PasswordExpirationDate ; date password expires
$ary_Data[10] = $objUser.IsAccountLocked ; True if account is locked
$ary_Data[11] = $objUser.AccountDisabled ; True if account is disabled
$ary_Data[12] = $objUser.PasswordExpired ; True if password is expired (must change on next login)
EndIf
; display the results
For $X = 5 to 12
$X '.' Chr(9) $ary_DATA[$X] ?
Next
?
; When was the last password change
'Password last changed on: '
If $ary_DATA[8] > 0
$LastChange = TimeConvert(TimeConvert(@DATE + ' ' + @TIME) - $ary_DATA[8])
$LastChange ?
EndIf
?
; How old is the password?
'Password age is: '
If $ary_DATA[8] > 0
TimeDiff($LastChange, 'Today', 'D') ' days' ?
EndIf
quit 0