Recently I needed to pull a large list of servers from Active Directory based on a common term in the computer name. This common term was not at the front of the name or at the end but in the middle of the computer name on each of these servers. Because of this I had to do a LDAP Query using the wildcard at the beginning and end of term. Another thing is that these servers were all over the place so they were not in a single OU. If they were in a single OU I could have simple done an export from the OU into a CSV file. I was able to run a custom LDAP query search in AD to pull a list of all the servers I needed but there was no way to export the results of this list into a CSV file.
I ran across an LDAP tool that would let me run an LDAP search and then export those results into CSV format. It is LDAP Browser (The free one) by Softerra. Here is the link: http://www.ldapbrowser.com/download.htm. They have a commercial tool and a free one with less features. Here are a few screenshots and what I did to get the list.
Connect to your AD.
Right click on the root of your directory and select Directory Search.
Input your LDAP Query and click Search.
Once you get the results you want click Save Results. Save the results in the format you want i.e. Excel, CSV, text…..
This is what the original results will look like:
With some quick cleanup (my friend replace) it should look like so after: