Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$Report = $Users.Values | Select Name,SamAccountName,@{Name="Last Logon Date";Expression={ If ($_.lastLogon) { [datetime]::FromFileTime($_.lastLogon) } Else { "None" }}}
$Report | Export-CSV C:\Scripts\LastLogonReport.csv -NoTypeInformation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment