PwdLastSet

From Null-pointer

Jump to: navigation, search

Reading the pwdLastSet field

This field contain the value of the last time the password was set. It is in the number of seconds that have passed since Jan 1, 1601.

  • Example: pwdLastSet: 128232747798495876

To find out this time in java use the following method:

 private static Calendar getTime(long pwdLastSet)
 {
   long javaTime = pwdLastSet - 0x19db1ded53e8000L;
   javaTime /= 10000;

   Calendar cal = Calendar.getInstance();
   cal.setTimeInMillis(javaTime);
   return cal;
 }

I have no idea how this works, but from all the examples, this one was the shortest, and it also worked.

Taken from this java sun forum.

Using JDNI to change Password in Active Directory

Using JDNI to change Password in Active Directory

Personal tools