\n1600-12-31_07:00:00 would signify that the account hasn’t authenticated against whichever DC you’re querying, as it is “null” in timestamp format.<\/p>\n<\/blockquote>\n<\/aside>\n
Correct!<\/p>\n
That means the lastLogonTimestamp attribute is null (empty) for those accounts. \nThe “zero” date for LargeInteger datetime values is 12:00 am Jan. 1 1601, in UTC (Coordinated Universal Time).<\/p>\n
So those users never logged in.<\/p>","upvoteCount":1,"datePublished":"2022-03-25T16:11:07.000Z","url":"https://community.spiceworks.com/t/last-logon-script-not-showing-correct-time/828760/7","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"
Also different events update different times stamps.<\/p>\n
I usually check lastlogon AND LastLogonTimeStamp<\/p>\n
Not ALL event cause lastlogon to update and not ALL events cause LastLogonTimeStamp to replicate (with a up to 14 days delay anyways)<\/p>\n
Get-ADUser -Filter \"enabled -eq 'true'\" -Properties LastLogonTimeStamp,lastlogon |\nSelect-Object Name,\n@{n=\"LastLogonTimeStamp\"; e={[DateTime]::FromFileTime($_.lastLogonTimestamp)}},\n@{n=\"lastlogon\"; e={[DateTime]::FromFileTime($_.lastlogon)}}\n<\/code><\/pre>\n <\/p>","upvoteCount":0,"datePublished":"2022-03-25T16:38:42.000Z","url":"https://community.spiceworks.com/t/last-logon-script-not-showing-correct-time/828760/8","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"\n\n
<\/div>\n
Neally:<\/div>\n
\nAlso different events update different times stamps.<\/p>\n
I usually check lastlogon AND LastLogonTimeStamp<\/p>\n
Not ALL event cause lastlogon to update and not ALL events cause LastLogonTimeStamp to replicate (with a up to 14 days delay anyways)<\/p>\n
Get-ADUser -Filter \"enabled -eq 'true'\" -Properties LastLogonTimeStamp,lastlogon |\nSelect-Object Name,\n@{n=\"LastLogonTimeStamp\"; e={[DateTime]::FromFileTime($_.lastLogonTimestamp)}},\n@{n=\"lastlogon\"; e={[DateTime]::FromFileTime($_.lastlogon)}}\n<\/code><\/pre>\n<\/blockquote>\n<\/aside>\nIs Seymour part of your AD?<\/p>","upvoteCount":0,"datePublished":"2022-03-25T16:41:42.000Z","url":"https://community.spiceworks.com/t/last-logon-script-not-showing-correct-time/828760/9","author":{"@type":"Person","name":"big-green-man","url":"https://community.spiceworks.com/u/big-green-man"}},{"@type":"Answer","text":"\n\n
<\/div>\n
Big Green Man:<\/div>\n
\nIs Seymour part of your AD?<\/p>\n<\/blockquote>\n<\/aside>\n
Maybe…<\/p>\n
<\/p>","upvoteCount":1,"datePublished":"2022-03-25T16:46:00.000Z","url":"https://community.spiceworks.com/t/last-logon-script-not-showing-correct-time/828760/10","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"
I updated the script to include lastlogon. Service accounts show me the correct value, but other AD accounts still show the same. I look at the attributes individually and the attribute shows a recent logon. Why isn’t Powershell pulling these attributes correctly?<\/p>","upvoteCount":0,"datePublished":"2022-03-25T17:41:56.000Z","url":"https://community.spiceworks.com/t/last-logon-script-not-showing-correct-time/828760/11","author":{"@type":"Person","name":"phonysoprano","url":"https://community.spiceworks.com/u/phonysoprano"}},{"@type":"Answer","text":"
I have been beating my head over this. I thought I had set the script to run as admin, apparently I didn’t. That’s all it took. Thank you.<\/p>","upvoteCount":0,"datePublished":"2022-03-25T17:55:43.000Z","url":"https://community.spiceworks.com/t/last-logon-script-not-showing-correct-time/828760/13","author":{"@type":"Person","name":"phonysoprano","url":"https://community.spiceworks.com/u/phonysoprano"}}]}}
Neally
(Neally)
March 25, 2022, 3:59pm
2
If you post code, please use the ‘Insert Code’ button. Please and thank you!
Hi, and welcome to the PowerShell forum!
Don’t apologize for being a “noob” or “newbie” or “n00b.” There’s just no need – nobody will think you’re stupid, and the forums are all about asking questions. Just ask!
Use a descriptive subject. Don’t say “Need help” or “PowerShell Help”, actually summarize what the problem is. It helps the rest of us keep track of which problem is which.
Don’t post massive scripts. We’re all volunteers and we don’t have time to read all that, nor will we copy…