AntiMalware Status

Export all users from Active Directory to CSV with PowerShell

Quick and dirty PowerShell snippet to export all Active Directory users with these selected attributes into CSV file where the attributes will be headers of the columns.

Import-Module ActiveDirectory
Get-ADUser -Filter * -Properties * |
Select-Object SamAccountName,GivenName,Surname,DisplayName,Title,Manager,EmployeeID |
Export-CSV -Path C:\Outputs\AD2Users.csv -NoTypeInformation -Encoding UTF8

Once you execute the script, it will create the AD2Users.csv file in same directory as is the script. You can Specify your path by adding correct export path such as [ C:\Outputs\AD2Users.csv ] or something similar. As well you can add or remove attributes you require for your export and needs.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.