Export AD Audit details to CSV

Subscribe to my newsletter and never miss my upcoming articles

Very useful script I wrote to generate a .csv that shows valuable information from Active Directory.

$OutputPath = "c:\\support\\users.csv"  

$Year = "2019"  

$filename = "$($Year)\_users.csv"  

$YearUsers = Get-ADUser -Filter  {(Enabled -eq "True")} -Properties created, lastlogondate,passwordlastset,passwordneverexpires  

$YearUsers | select name, samaccountname, created,lastlogondate,passwordlastset,passwordneverexpires |  

Export-Csv -Path $OutputPath$filename -NoTypeInformation -Force

No Comments Yet