Exporting an Active Directory User List
Exporting an Active Directory user list means extracting object attributes—such as display name, user principal name, department, and last logon—into a portable file. The right method depends on what fields you need, how many users you are targeting, and whether the output will feed a spreadsheet, a compliance archive, or an automated workflow. The core options are PowerShell, CSVDE, LDIFDE, and the Active Directory Users and Computers snap-in, each with distinct trade-offs around flexibility and format.
More from this site
Keep reading the latest coverage
Using PowerShell with the ActiveDirectory Module
PowerShell is the most common approach for exporting an Active Directory user list because it lets you filter by organizational unit, group membership, or attribute value and project only the columns you care about.
- Import the module: Import-Module ActiveDirectory
- Basic export: Get-ADUser -Filter * -Properties DisplayName,Department,Title | Select-Object Name,SamAccountName,DisplayName,Department,Title | Export-Csv -Path C:\Export\users.csv -NoTypeInformation
- Filtered export: add a -Filter such as Department -eq "Sales" or Enabled -eq $true to narrow results.
- Include additional properties: append them to the -Properties parameter and to the Select-Object list.
PowerShell also supports exporting to other formats, such as tab-delimited text or JSON, by changing the Export-Csv cmdlet or piping to ConvertTo-Json. The -Properties parameter is essential; attributes not loaded into memory will return blank values.
Using CSVDE and LDIFDE
For environments where PowerShell is not available or where a lightweight, schema-compliant export is preferred, CSVDE and LDIFDE are built-in command-line tools.
- CSVDE exports to comma-separated values and is read-only, making it safe for quick snapshots. A typical command is csvde -f C:\Export\users.csv -r "(objectClass=user)".
- LDIFDE exports to LDAP Data Interchange Format and is also read-only, but it preserves attribute names in a way that is easy to re-import. Example: ldifde -f C:\Export\users.ldf -r "(objectClass=user)".
Neither tool supports the same depth of filtering as PowerShell, and both export a fixed set of common attributes. They are useful for quick audits or when you need a file that other LDAP-aware tools can consume directly.
Using Active Directory Users and Computers
The ADUC MMC snap-in provides a graphical path to export an Active Directory user list, which can be helpful for administrators less comfortable with the command line.
- Open ADUC, navigate to the domain or OU, and select all users.
- Go to File > Save As and choose a CSV or HTML report.
The default columns are limited, so this method is best for quick, ad-hoc exports rather than scheduled or heavily filtered extracts. For repeated exports with custom columns, a PowerShell script is more reliable.
Choosing the Right Export Format
The format you choose affects how downstream systems consume the data.
- CSV is universally readable in Excel and most BI tools, but it can break if fields contain commas or line breaks that are not properly escaped.
- LDIF preserves the LDAP attribute names and is suited for re-importing or for migration tools.
- JSON works well for APIs and automated pipelines.
When exporting passwords or sensitive attributes, be aware that most tools do not include password hashes by default, and attempting to capture them requires specific, highly privileged commands and carries significant security risk.
Filtering and Scheduling Exports
A well-filtered export saves time and reduces exposure. Common filters include OU path, account status, last logon timestamp, and group membership. To build a repeatable process, save your PowerShell command as a .ps1 script and schedule it in Task Scheduler. Capture the date in the filename to maintain version history, and store the output in a restricted folder with access limited to the reporting role.
Verifying and Securing the Output
After export, open the file in a text editor or spreadsheet to confirm the row count matches expectations and that no sensitive columns were inadvertently included. Treat exported user lists as sensitive data: encrypt the file at rest, limit distribution, and delete temporary copies when they are no longer needed. For compliance-sensitive environments, document the export parameters and the reviewer who approved the output.