Once again I had an eye opening experience on how much I really don’t know. I was working with a client and needed to export a list of users from active directory who were all part of an specific organizational group (OU). Now I have done some coding against the Active Drectory before with WMI / ADSI but in this case I just wanted a simple export. I began looking around for options and did not find to many simple solutions. To me this seemed like a very simple and trivial task that has to have been done before. But I could not find any great documentation. So I tried a few things. 1. I tried to just use the MMC and select the organization unit and right click and export. I did not really like what it gave me .. Just usernames. 2. I then used an old .vbs script I had to parse through the ou and return values. This seemed to be the solution but seemed too hard for a novice users. So I kept looking. And I found the solution. 3. CSVDE it imports and exports data from the active directory to a CSV file.
You may ask where did you find this? Well it is build into Windows 2000 and 2oo3. I had never even heard of this before. The help file calls it CSV Directlry Exchange. It does not really even show up on any google searches, even when you search directly for it. Now that I have found this tool I am not going to let it go.
Here is an example of what I did. To get a selected OU group into a csv file.
CSVE -f adexport.csv -n
The above will give you all active directory accounts. I used the -n filter to remove any binary values. I then used Excel to direct a list of all OU’s.