Microsoft KB Archive/192949

{|
 * width="100%"|

HOWTO: Find Password Last Changed Date Using ADSI

 * }

Q192949

-

The information in this article applies to:


 * Microsoft Windows 95
 * Microsoft Windows NT Server
 * Microsoft Active Directory Service Interfaces, version 2.5

-

SUMMARY
The Active Directory Service Interfaces (ADSI) Windows NT provider does not support the PasswordLastChanged Property of an IADsUser object. You can compute this date by subtracting the password expiration period (converted to days) from the password expiration date to get the last change date. Note that for users whose passwords never expire, the PasswordExpirationDate will be in the past and the computation still works correctly.

MORE INFORMATION
The following Visual Basic code illustrates this:

Set adsUser = GetObject("WinNT://" + strDomain + "/" + strUser + _   ",user")

Debug.Print "Password Last Changed on : " + _ CStr(adsUser.PasswordExpirationDate - _     adsUser.Get("MaxPasswordAge") / (60& * 60 * 24))