How to export Exchange distribution list properties?

I need to script the export of all distribution lists (query-based or otherwise), the manager (if defined), whether the manager has the ability to update the list, and whether there are restrictions on sending to each list. What's the easiest method to do this? Specific examples would be appreciated.
Who is Participating?
JimMuellerConnect With a Mentor Author Commented:
I guess it was a simple typo, it's working now!

C:\temp>csvde -f c:\temp\DistributionLists.csv -p subtree -l cn,mail,member  -r
namicDistributionList)(&(samAccountType=268435456)(mail=*)))" -j c:\temp
Connecting to ""
Logging in as current user using SSPI
Exporting directory to file c:\temp\DistributionLists.csv
Searching for entries...
Writing out entries
Export Completed. Post-processing in progress...
81 entries exported

The command has completed successfully
Try Get-DistributionGroup | Format-List
JimMuellerAuthor Commented:
I'm not familiar with which interface I would use those commands...?
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Would help if you identified the version of Exchange involved. The command above is for Exchange 2007.

JimMuellerAuthor Commented:
Sorry, Exchange 2003 SP2.
JimMuellerAuthor Commented:
So far I have this, which exports the cn, manager, users approved to send, and DL's approved to send. I haven't been able to isolate 1) which ADSI attribute indicates their are sending restrictions, (or perhaps it's simply whether AuthOrig and/or dlMemSubmitPerms have non-default values) and 2) which ADSI attribute indicates whether the manager has permission to modify the membership.

csvde -f c:\temp\groups.csv -p subtree -l cn,managedBy,AuthOrig,dLMemSubmitPerms  -r "(|(&(objectCategory=Group)(objectClass=Group)(|(groupType=8)(groupType=4)(groupType=2)))(objectCategory=ms-Exch-Dynamic-Distribution-List)(objectClass=msExchDynamicDistributionList))" -j c:\temp
JimMuellerAuthor Commented:
Dang it, I just found that we have e-mail enabled security groups also that I need to be included.
JimMuellerAuthor Commented:
I found this separate command which will export the e-mail enabled security groups. Can I merge the aforementioned csvde command and this dsquery command together?

DSQuery * ForestRoot -Filter "(&(samAccountType=268435456)(mail=*))" -Limit 0
JimMuellerAuthor Commented:
It appears the following syntax is working correctly as a ADUC prefixed the "(&" and the final ")" to my query:


...but when I try to use the exact same syntax with csvde...

C:\temp>C:\temp>csvde -f c:\temp\groups.csv -p subtree -l cn,managedB
y,AuthOrig,dLMemSubmitPerms -r "(&(|(&(objectCategory=Group)(objectClass=Group)(
56)(mail=*))))" -j c:\temp gives me the error:

| was unexpected at this time.

If I drop off the prefix and suffix characters it put in the ADUC query, it then tells me "& was unexpected at thsis time." What am I doing wrong?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.