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
- 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
Results: Here is how the report would look like:
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.
I am working in an IT company and having 10+ years of experience into Cisco IP Telephony and Contact Center. I have worked on products like CUCM, CUC, UCCX, CME/CUE, IM&P, Voice Gateways, VG224, Gatekeepers, Attendant Console, Expressway, Mediasense, Asterisk, Microsoft Teams, Zoom etc. I am not an expert but i keep exploring whenever and wherever i can and share whatever i know. You can visit my LinkedIn profile by clicking on the icon below.
“Everyone you will ever meet knows something you don’t.” ― Bill Nye
Pingback: Powershell query to remove Bulk AD/LDAP users attribute to blank