An employee left the company. I try to find out when his AD account was logged in for the last time - if it was before the dismissal or after.

There are these 2 attributes in user properties window: lastLogon and lastLogonTimestamp. lastLogon date is earlier than the dismissal date, but lastLogonTimestamp date is posterior to the dismissal date (so in this case we would have a security problem).

How to know, which one of these attributes shows the actual last AD account login time? What is the difference between them?

user properties - attribute editor


Use the most recent attribute.

Lastlogon is only updated on the domain controller that performs the authentication and is not replicated.

LastLogontimestamp is replicated, but by default only if it is 14 days or more older than the previous value.



TL;DR - If you want the most accurate logon time, you must query the lastLogon attribute from all domain controllers. If a tolerance ±19 days is acceptable, then you can just read lastLogonTimestamp from the closest domain controller.


This attribute is not replicated and is maintained separately on each domain controller in the domain. To get an accurate value for the user's last logon in the domain, the Last-Logon attribute for the user must be retrieved from every domain controller in the domain. The largest value that is retrieved is the true last logon time for that user.



Whenever a user logs on, the value of this attribute is read from the DC. If the value is older [ current_time - msDS-LogonTimeSyncInterval ], the value is updated. The initial update after the raise of the domain functional level is calculated as 14 days minus random percentage of 5 days.



  1. Both dates are stored as a FILETIME (Int64 in .Net/PowerShell) if you retrieve them programatically.
  2. PowerShell also provides a LastLogonDate property. I would have preferred to provide Microsoft specific documentation to confirm this, but most sources say and my testing confirms it is the lastLogonTimestamp converted to a l̲o̲c̲a̲l̲ DateTime value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.