How To Find Password Last Changed Date Using ADSI (192949)



The information in this article applies to:

  • Microsoft Windows 95
  • Microsoft Windows NT Server
  • Microsoft Active Directory Service Interfaces 2.5

This article was previously published under Q192949

SUMMARY

The Active Directory Service Interfaces (ADSI) Windows NT provider does not support the PasswordLastChanged Property of an IADsUser object. You can computer this date by subtracting the password expiration period 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( _
       DateAdd("s", -adsUser.Get("MaxPasswordAge"), _
           adsUser.PasswordExpirationDate))
				

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:

Modification Type:MinorLast Reviewed:3/3/2005
Keywords:kbAPI kbhowto kbnetwork KB192949