Export Users From Active Directory

How to export users from Active DirectoryIn this tutorial, I will show you how to export users from Active Directory to a csv.

Exporting a list of Active Directory users is a common request I see. This is requested for a number of reasons such as, migrating users, auditing and reporting, importing to other programs and so on.

Below, I walk through two different methods for exporting users.

Export Users with PowerShell

If you’re not into PowerShell then jump to method 2 for a GUI based export option.

To export users with PowerShell the AD Powershell module needs to be loaded.

If you have the RSAT tools installed or access to a server with the AD RS role installed then you are all set.

Recommended Tool: SolarWinds Admin Bundle for Active Directory

3 Free tools, find inactive user or computer accounts  and quickly bulk import new user accounts.

Download your free copy of Admin Bundle for Active Directory

First, you need to determine what user attributes to export. If you want just the username you can use the name attribute (example below)

To get a list of all the user’s attributes run this command on one user

get-aduser username -Properties *

This will display a lot of information but it will help you determine what to export. Ok, let’s look at some examples.

To export these results to a csv just add | export-csv -patch filepath.csv

Example 1: Export all users by name

This command will export all users by name

Get-ADUser -Filter * -Properties * | Select-Object name | export-csv -path c:\export\allusers.scv

Example 2: Export all users by name and lastlogondate

The command will export all users by name and their last logon date.

get-aduser –filter * -property * | Select-object Name, LastLogonDate

Example 3: Export all users by name and email

This will export all users by name and their email address

get-aduser –filter * -property * | Select-object Name, mail

Example 4: Export all from a specific OU

This will export all users from a specific OU.

Get-ADUser -Filter * -SearchBase "OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM"

Related: How to export Active Directory Group Members

Export Users with Active Directory Users and Computers

This method uses the Active Directory Users and Computers console to export users.

Step 1: Open Active Directory Users and Computers

Step 2: Browse to the container that has the users you want to export.

In my test environment, I’ll be exporting the users from the HR container.

Step 3: Click the export button

Now just browse to where you want to save the file, name it and change save as type to a scv.

I’ll open the csv file in excel to verify it exported.

Yes, it worked.

How do you export all users?

The problem with exporting users from ADUC is that it only exports users from a specific folder. If you have users organized into many different folders, you would have to export from each one of them.

To export all the users I’ll need to create an LDAP query that displays them all, then I can export.

Watch this video for details.

Here is the LDAP query that I use in the video


If you liked this video or have questions leave a quick comment below.

See Also:
Top 5 AD Bulk Import Tools
How to find a user’s last logon time

Recommended Tool: SolarWinds Server & Application Monitor (SAM)

This utility was designed to Monitor Active Directory and other critical applications. It will quickly spot domain controller issues, prevent replication failures, track failed logon attempts and much more.

What I like best about SAM is it’s easy to use dashboard and alerting features. It also has the ability to monitor virtual machines and storage.

Download Your Free Trial of SolarWinds Server & Application Monitor. 


  1. Jeremy C on July 20, 2018 at 11:30 pm

    Thank you for posting this. It was very helpful for me today.

    • Robert Allen on July 23, 2018 at 6:37 pm

      No problem, glad it was helpful!

  2. ruin on July 26, 2018 at 11:06 am

    hi there
    i want to know how do i export all my users in AD with all permissions ??

    • Robert Allen on October 19, 2018 at 11:22 pm

      What do you mean by all permissions? Are you wanting the security group membership?

Leave a Comment