How to Export Active Directory Users to CSV

There are several ways to export Active Directory users to CSV. In this guide, I’ll show you how to export users with PowerShell and the AD Pro Toolkit.

Table of contents

Export AD Users to CSV with PowerShell

Step 1. Open PowerShell as administrator

Step 2. Run the following command to export all users to CSV:

Get-ADUser -Filter * -Properties DisplayName, EmailAddress, Department | Select Name, DisplayName, EmailAddress, Department | Export-Csv c:\reports\ad-users.csv -NoTypeInformation

Export and include all attributes

Get-ADUser -Filter * -Properties * | Export-Csv c:\reports\all-users.csv -NoTypeInformation

Export User List from Active Directory with AD Pro Toolkit

The AD Pro Toolkit makes it easy to export a user list from Active Directory without PowerShell. It includes built-in reports that can be exported to CSV, Excel, or PDF with a few clicks. It’s one of 200+ built-in reports in the AD reporting tool.

Step 1. Click on the All Users Report

Step 2. Click “Run Report” to list users from Active Directory

Note: By default, it will list all users, you can click “Browse” to list users from a specific OU”. You can filter the list to get specific users such as disable, by department, by OU and so on.

export list of ad users

Step 3. Click the “Export” button to export the list.

export list to csv

Export CSV Example

csv export example

Export Users from a Specific OU

With PowerShell use the -SearchBase parameter with the OU’s distinguished name:

Get-ADUser -Filter * -SearchBase "OU=Sales,DC=ad,DC=activedirectorypro,DC=com" -Properties DisplayName, EmailAddress, Department | Select Name, DisplayName, EmailAddress, Department | Export-Csv c:\reports\sales-users.csv -NoTypeInformation

With the AD Pro Toolkit click “Browse OU” and select the OU.

export ad users from ou

Get All Users from Active Directory

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.csv

Export users to CSV with last logon date

get-aduser -Filter *  -Properties * | select displayname, LastLogonDate | export-csv -path c:\temp\export_lastlogon.csv

Related Articles