• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 34
  • Last Modified:

get-aduser not returning lastlogontimestamp

I've ran get-aduser to get all attributes but bizarrely for users it doesn't include the lastlogontimestamp. The same command from get-adcomputer does run and return that field, but get-aduser does not. any theory why that may be. lastlogondate is populated but my understanding was its not particularly accurate and lastlogontimestamp is reflective of any DC last logged into. I am unsure it this is to do with their AD setup or any other theories?
0
pma111
Asked:
pma111
3 Solutions
 
Kevin StanushApplication DeveloperCommented:
Include the exact command that you are using.  If these are new user accounts, it won't be populated until the update mechanism/formula triggers the update.
0
 
pma111Author Commented:
Its not returning the column at all in the report its not just blank for some users and not others it doesnt return the column
0
 
pma111Author Commented:
Get-aduser -properties * -filter * | export-csv

Weirdly running the same for get-adcomputer did return that property.
0
Improved Protection from Phishing Attacks

WatchGuard DNSWatch reduces malware infections by detecting and blocking malicious DNS requests, improving your ability to protect employees from phishing attacks. Learn more about our newest service included in Total Security Suite today!

 
Kevin StanushApplication DeveloperCommented:
Get all properties is sort of messy, so try just instead:

get-aduser -properties name,displayname,lastlogontimestamp -filter *

I suspect that the default view is just leaving this attribute out.
0
 
M SCommented:
All "Get-AD*"-CMDLets uses two sets of Properties. Default Properties and Extended Properties.

Default properties will be included in your output, if u do not specify the "-Properties" Parameter. Extended Properties must be specified for being included in your output.

lastlogontimestamp is an extended property :)

Here is an overview of the Default and Extended Properties of "Get-ADUser". MS Technet
1
 
Naveen SharmaCommented:
Try something like:
Get-aduser -filter * -properties * | ft name,lastlogon,lastlogontimestamp,lastlogondate

Open in new window


The LastLogonTimeStamp Attribute – What it was designed for and how it works:
https://blogs.technet.microsoft.com/askds/2009/04/15/the-lastlogontimestamp-attribute-what-it-was-designed-for-and-how-it-works/

Detect Last Logon Date and Time for all Active Directory Users:
https://www.lepide.com/how-to/track-last-logon-date-and-time-for-active-directory-users.html
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now