How to Export Active Directory Objects to CSV

In organizations that use Active Directory, export of Active Directory objects is a frequent task for IT pros. With native tools, export of Active Directory objects to CSV means using a PowerShell script, which takes time. But with the right tool, IT admins can perform an export of AD objects to CSV and get a readable report in minutes.

  1. Open the Powershell ISE → Create a new script with the following code and run it.
Get-ADObject -Filter 'Name -like "*"'  |
Where-Object {$_.ObjectClass -eq "user" -or $_.ObjectClass -eq "computer" -or $_.ObjectClass -eq "group" -or $_.ObjectClass -eq "organizationalUnit"} | Sort-Object ObjectClass | Export-CSV C:\Temp\ExportAD.csv -notypeinformation
  1. Open the file produced by the script in MS Excel.
  2. Report example:
    https://img.netwrix.com/howtos/export_ad_2.png

Credits

Originally posted - https://www.netwrix.com/how_to_export_active_directory_objects_to_csv.html