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.

You may also like...

1 Response

  1. May 15, 2020

    […] In the last article, we saw how to export all users from Active Directory to an excel with the attributes you need. In case you missed to read the article, please follow this link. […]

Leave a Reply

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