Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

lastLogonTimestamp: How to return true NULL instead of those 01.01.1601 4:00:00 for users who never logged in?

$
0
0

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




Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>