Browse By

Powershell Query to get all the users from AD with attributes

Powershell Query to get all the users from AD with attributes

Recently i was working in AD and thought of exporting all the user details with some specific attributes like thie IP Phone Number, Telephone Number, Email Address etc.

If you are a Powershell expert, then it is just a matter of some seconds to build that query, but for the people who does not know much about powershell, this is little tedious for them. I searched over web and found a powershell script which exports Display Names, Email Address to a CSV file. I modified the script and added the attributes that are required for my task.

The attributes i included are:

  • Enabled
  • DisplayName
  • Mail
  • SAMAccountName
  • IPPhone
  • HomePhone
  • TelephoneNumber

Powershell Script:

Get-ADUser -filter * -properties Enabled,DisplayName,Mail,SAMAccountName,homephone,ipphone,TelephoneNumber | select Enabled,DisplayName,Mail,SAMAccountName,homephone,ipphone,TelephoneNumber | export-csv users.csv

uccollabing.com

Results: Here is how the report would look like:

uccollabing.com

In our previous post, we already spoke about how to get these LDAP attributes. In case, you missed to read the article, please follow the link.

Originally posted 2020-05-15 10:01:22. Published by Team UC Collabing

One thought on “Powershell Query to get all the users from AD with attributes”

  1. Pingback: Powershell query to remove Bulk AD/LDAP users attribute to blank
  2. Trackback: Powershell query to remove Bulk AD/LDAP users attribute to blank

Leave a Reply

Your email address will not be published.