Get-ADUser -Filter {Enabled -eq $true} -Properties Name,Manager,LastLogon,DistinguishedName |
Select-Object Name,samAccountName,DistinguishedName,@{n='LastLogon';e={[DateTime]::FromFileTime($_.LastLogon).ToString('g')}} |
Export-Csv -NoTypeInformation -Path LastLogonEnabledOnly.csv
0 Comments