Jump to content
Toggle menu
  • 51 articles
  • 24 files
  • 4 users
  • 750 edits
Tech-Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Exporting AD users and its info to a text file

From Tech-Wiki


Export Active Directory user information with the ActiveDirectory PowerShell module and structured CSV output.

ⓘ
Validation status
Modernised on 27 September 2026. The legacy recursive ADSI/VBScript export has been replaced with a concise PowerShell workflow.

Basic export

Get-ADUser -Filter * -Properties DisplayName,Description,Office,EmailAddress,OfficePhone,ScriptPath,Enabled,PasswordLastSet,PasswordNeverExpires |
    Select-Object SamAccountName,DisplayName,Description,Office,EmailAddress,OfficePhone,ScriptPath,Enabled,PasswordLastSet,PasswordNeverExpires |
    Export-Csv -Path C:\Temp\AD-Users.csv -NoTypeInformation -Encoding UTF8

Include group membership

Get-ADUser -Filter * -Properties MemberOf,DisplayName,EmailAddress |
    Select-Object SamAccountName,DisplayName,EmailAddress,@{Name='MemberOf';Expression={$_.MemberOf -join ';'}} |
    Export-Csv -Path C:\Temp\AD-Users-With-Groups.csv -NoTypeInformation -Encoding UTF8
ⓘ
Last logon fields
Active Directory exposes several logon-related attributes with different replication semantics. Select the field that matches the reporting requirement rather than assuming a single lastLogon value is authoritative across all domain controllers.
!
Protect exported user data
The CSV can contain personal and privileged account information. Store and share it according to the organisation's data-handling requirements.

Official references