I'm trying to generate a report for a customer that lists out display name, office and description for each member of each distribution list they have in AD.
I hacked something together using csvde but it's giving me unexpected results... The Forest at this customer consists of a parent (root) domain and two child domains. All the distribution lists are located in the parent/root domain. When I run my mini-script against the OU that contains all of the distribution lists though, I only get results if the user account is found in the parent domain. Any users that are in child domains simply don't show up in the report... I feel like I'm missing something simple here but I can't find it for the life of me.
Attached is my little script that I've been running so far.
if exist groups.txt del groups.txt
dsquery group "OU=DistributionLists,DC=domain,DC=com" >groups.txt
for /f "tokens=*" %%g in (groups.txt) do csvde -f %%g-report.txt -s rootdc2 -r (memberof=%%g) -l displayname,physicaldeliveryofficename,description,mail