Hello all, can you please help to change the script to return true NULL instead of those 01.01.1601 4:00:00 for users who never logged in?
I assume it can be done via using some IF check.
The script that I use is from this forum:
Get-ADUser -Filter * -SearchBase "ou=users,dc=contoso,dc=local" -ResultPageSize 0 -Prop CN,lastLogonTimestamp | Select CN,@{n="lastLogonDate";e={[datetime]::FromFileTime($_.lastLogonTimestamp)}} | Export-CSV -NoType last.csv
MCP