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.

1 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

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top