Get List Of Active Directory Users With Their Last Logon Date
Maybe your like
Get a list of active users is pretty trivial with powershell, however with multiple AD controllers, things become more complicated. There are effective two fields LastLogon and LastLogonTimestamp. Depending on replication and AD server, the values may be different.
The following Powershell script will query each ADC and get the most recent login date:
https://github.com/CrestlineIT/PowerShellSnippets/blob/master/ADUserLastLogon.ps1
To export the list in CSV, simply use it like this:
ADUserLastLogon.ps1 | Export-CSV -Path "C:\temp\ADUsers.csv" -NoTypeInformation
For more information about each attribute, see below:
lastLogon
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.
https://docs.microsoft.com/en-us/windows/desktop/adschema/a-lastlogon lastLogonTimestamp
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.
https://docs.microsoft.com/en-us/windows/desktop/adschema/a-lastlogontimestamp
Related articles
General
IT Careers in Ottawa: Education That Opens Doors in TechFebruary 16, 2026
Blog
Benefits of Managed IT Services: Protect Your Business, Cut Costs & Grow SmarterJanuary 20, 2026
Blog
Digital Armor: Top 10 Tips for Protecting Yourself OnlineFebruary 06, 2025
Do you need IT, cybersecurity or software development services?
Discover Crestline IT, a trusted Canadian IT company based in Toronto, Ontario.
Discover Crestline IT × ×Tag » Active Directory Get List Of Computer Last Logon Date
-
How To Find Active Directory User's/Computer's Last Logon Time?
-
Get-ADComputer Last Logon Using PowerShell - ShellGeek
-
Get A List Of AD Computer Objects With Last Logon Date And OS Version
-
Find Last Logon Time/Date Of Users/Computers | Powershell & AD
-
Find Inactive Computer Objects With LastLogonTimeStamp
-
How To Generate Reports On Last Logon Time Of AD Computers Using ...
-
How To Find User's Last Logon Time In A Workstation - ManageEngine
-
Scripting - Get-ADComputer - How To Retrieve Computer Last Logon Date
-
How To Find Active Directory User's/Computer's Last Logon Time?
-
Retrieve Computer Last Logon On Domain Controller With PowerShell
-
How To Find Inactive Computers In AD With Or Without PowerShell
-
How To Detect Every Active Directory User's Last Logon Date - Netwrix
-
Find User's Last Logon Time Using 4 Easy Methods - Prajwal Desai
-
How To Find A User's Last Logon Time - Active Directory Pro