An auditor ask for a AD listing with the following information:
name, SAMAccountname, Created,LastLogonTimeStamp and Enabled
I´ve created two options
Get-ADUser -Filter {ObjectClass -eq 'user'} -Properties SAMAccountname,Name,Enabled,LastLogonTimeStamp,Created | Select-Object SAMAccountname,Name,Enabled,@{Name="LastLogonTimeStamp"; Expression={[DateTime]::FromFileTime($_.lastLogonTimestamp).ToString('yyyy-MM-dd')}},created | export-csv outputfile.csv -notypeinformation
Get-ADUser -Filter {ObjectClass -eq 'user'} -Properties SAMAccountname,Name,Enabled,LastLogonTimeStamp,Created | Select-Object SAMAccountname,Name,Enabled,@{Name="LastLogonTimeStamp"; Expression={[DateTime]::FromFileTime($_.lastLogonTimestamp).ToString('yyyy-MM-dd')}},created
These are the most "elegant" and/or more efficient commands?
There are more simpler ways to grab the information?
This suggested approach have a problem? some performance or inneficient problem?