Export AD Users To CSV With PowerShell - Active Directory Pro
Maybe your like
In this tutorial, I’ll show you two options on how to export Active Directory Users to CSV. I’ll also show you how to export users from an OU, and get specific user attributes like last logon, email addresses, state, city, and so on.
Table of contents
- Option 1. Export AD Users to CSV with the AD Pro Toolkit
- Option 2. Export AD Users to CSV with PowerShell
- How to Export All Users from Active Directory
Option 1. Export AD Users to CSV with the AD Pro Toolkit
In this first example, I’ll Export Users with the AD Pro Toolkit. This tool makes it very easy to export all users or users from an OU and groups.
Step 1. Download the AD Pro Toolkit
Click here to download a free trial
You can install the tool on your local computer or a server.
Step 2. Open Export Users Tool
Under Management Tools click on “Export”.

Step 3. Select Path
By default, the tool will export all domain users. To export users from a specific OU or group click the browse button. In this example, I have selected two OUs that I want to export users from.

Step 4. Add or Remove user Attributes
Click “Columns” to add or remove user attributes. You can also include custom attributes by clicking the “Add Custom Attribute” button. To re-arrange the attributes click the up or down arrows.

Step 5. Click “Run” to generate a list of users
This will display the accounts you want to export and all the properties you selected. This gives you a preview of what will be exported.
Step 6. Export the list of users
Click “Export” to export the list of AD users to CSV. Alternatively, you can select to export to Excel or PDF.

Below is an example from my export. So for each user, it will show you which security groups they are a member of and all the other user attributes I selected. Of course, you can just uncheck “memberOf” in the columns picker if you don’t want to see this info.

Option 2. Export AD Users to CSV with PowerShell
Here are the steps to export Active Directory users to CSV using PowerShell.
Step 1: Get-ADUser PowerShell Command
To export users with PowerShell, the Get-ADUser cmdlet is used. This command will get user accounts from Active Directory and display all or selected attributes. It’s important to know how this command works so you can export the data you need.
The most important thing to remember is how to display all the user attributes. This will come in useful when you want to export only specific account details.
The below command will get all user attributes for a single user.
get-aduser -identity username -Properties *Change the “username” to a user in your domain.
Pay attention to the left column. These are the user attribute names and the values on the right. In example 4, I’ll show you how to select specific attributes to include in the export.

Related: How to bulk modify user attributes
Step 2: Export to CSV command
Add “export-CSV -path” to the end of the command to export to a CSV file. See the below example, I’m exporting all the properties for this user to c:\temp\export.csv.
get-aduser -identity username -Properties * | export-csv -path c:\temp\export.csv
You should now have a CSV export of all user properties for a single user.
Step 3: Export specific user attributes
If you don’t want to export all user attributes then use the “select-object” command and enter only the attributes you need. If you have followed along from the beginning then you know how to find the attribute names, if not then jump to example 2.
In the below example I’ll export the DisplayName, City and State.
get-aduser -identity username -Properties * | select DisplayName, City, State | export-csv -path c:\temp\export.csvStep 4: How to export all users
To export all users remove (-identity) and add (-filter *) to the command. In the below example I’m exporting all users and selecting displayname, city, company, department, EmailAddress, and telephonenumber.
get-aduser -filter * -Properties * | select displayname, city, company, department, EmailAddress, telephonenumber | export-csv -path c:\temp\export-all.csvHere is what this looks like in PowerShell.

Here is the CSV.

Step 5: Export Users from a specific OU

To export users from specific OUs use the “-SearchBase” command and the “distinguishedName” value of the OU.
In the below example I’m getting all the users in my accounting OU.
Get-ADUser -Filter * -Properties * -SearchBase "OU=Accounting,OU=ADPRO Users,DC=ad,DC=activedirectorypro,DC=com" | select displayname, DistinguishedName, EnabledHere is the PowerShell output.

Then add export-csv -path to the end to export this to CSV.
Get-ADUser -Filter * -Properties * -SearchBase "OU=Accounting,OU=ADPRO Users,DC=ad,DC=activedirectorypro,DC=com" | select displayname, DistinguishedName, Enabled | export-csv -path c:\temp\export-ou.csvAt this point, you should be able to export single, all users, or users from a specific OU. I also showed you how to export all or specific user attributes.
Below are a few more PowerShell examples.
Export only enabled users
To get just the enabled user accounts you need to add a filter that searches for enabled = true.
Get-ADUser -Filter {Enabled -eq $true} -properties * | select-object samaccountname,givenname,surname,Enabled | export-csv -path c:\export\exportusers.csvExport users to CSV with last logon date
get-aduser -Filter * -Properties * | select displayname, LastLogonDate | export-csv -path c:\temp\export_lastlogon.csvHow to Export All Users from Active Directory
To export all users from Active Directory, follow these steps.
- Open the Export Users Tool
- Click “Run”
- Click the “Export” button and select CSV.
- Optionally, click the Columns button to add or remove attributes.

With PowerShell, the below command will export all users to CSV. This will just export the user’s name, you will need to add additional attributes as needed.
Get-ADUser -Filter * -Properties * | Select-Object name | export-csv -path c:\export\allusers.csvI hope this article helped you learn how to export ad users to csv. You may also want to see our guide on how to export group members to csv.
Related Articles
- Export Group members to csv
- Get all Email Address from Active Directory
- Find Accounts with Password Not Required
Tag » Active Directory Explorer Export Users
-
Export AD Users To Csv File - Microsoft Q&A
-
How To Export Users From Active Directory - Admin's Blog - CodeTwo
-
How To Export Active Directory Users To CSV And Build Reports
-
Export List Of All AD User Accounts - Spiceworks Community
-
How To Export Users From Active Directory And Import Them Into Office ...
-
Active Directory User Export Tool - YouTube
-
Export User From Active Directory – Powershell And ADUC FREE
-
Exporting Data From An Active Directory Organizational Unit
-
Export Active Directory Data To CSV, Excel, And More - ManageEngine
-
Get The List Of All Active Directory Users Using Powershell
-
How To Export Active Directory Users To CSV - Netwrix
-
Active Directory User Export Tool - CSV Generator - Dameware
-
Exporting Data To Csv From Active Directory - LDAPSoft LDAP Browser
-
Considerations And Limitations - Veeam Backup Explorers Guide