HOWTO: Find Password Last Changed Date Using ADSI

ID: Q192949


The information in this article applies to:
  • Microsoft Windows 95
  • Microsoft Windows NT 4.0, used with:
    • Alpha
    • x86
  • 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)) 


REFERENCES

Active Directory Service Interfaces (ADSI) documentation is available in the Platform SDK section of MSDN and in a help file you can download from the following Web site:

http://www.microsoft.com/adsi/

Additional query words:

Keywords : kbnetwork kbADSI kbAPI kbSDKPlatform kbGrpNet
Version : WINDOWS:95; winnt:2.5,4.0
Platform : WINDOWS winnt
Issue type : kbhowto


Last Reviewed: October 1, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.