KingM0ses
KingM0ses

Reputation: 64

How to extract all users information from Active Directory

I need to bulk "download" every user we have on Active directory.

I need the email address, location etc.

I have been looking into the PowerShell command "Get-ADuser -Filter", however I need some help getting this to work.

Upvotes: 2

Views: 17110

Answers (1)

scottwtang
scottwtang

Reputation: 2040

See the documentation for Get-ADUser which has several examples as well.

If you want to retrieve every user, you can use an asterisk * with the Filter parameter. Otherwise, you can filter using a specific property.

You can specify which properties to return using the Properties parameter. By default, the cmdlet will only return a default set of properties, which are below

  • DistinguishedName
  • Enabled
  • GivenName
  • Name
  • ObjectClass
  • ObjectGUID
  • SamAccountName
  • SID
  • Surname
  • UserPrincipalName

Example: Get every user with default property set

Get-ADUser -Filter *

Example: Get every enabled user with default property set

Get-ADUser -Filter 'enabled -eq $true'

Example: Get every user with specific properties

Get-ADUser -Filter * -Properties emailAddress,office,city

Example: Get every user with every property

Get-ADUser -Filter * -Properties *

Example: Get every user with every property and export as a CSV

Get-ADUser -Filter * -Properties * | Export-CSV -Path "C:\Temp\ADUsers.csv" -NoTypeInformation

Additional Info

Active Directory: Get-ADUser Default and Extended Properties

Upvotes: 4

Related Questions