Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking to get a list of all Distribution Lists in Exchange along with their members? Is this possible using any built-in Exchange tools? Powershell? Third party tools?

share|improve this question
up vote 6 down vote accepted

Distribution groups are stored in Active Directory. This Powershell script will list all the distribution groups in the AD domain and their members. If you atually have them stored as security groups, remove "(|(groupType=2)(groupType=4)(groupType=8))".

$strFilter = "(&(objectCategory=Group)(|(groupType=2)(groupType=4)(groupType=8)))"
$objDomain = New-Object System.DirectoryServices.DirectoryEntry
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.SearchRoot = $objDomain
$objSearcher.PageSize = 1000
$objSearcher.Filter = $strFilter
$objSearcher.SearchScope = "Subtree"
$objSearcher.PropertiesToLoad.Add("cn") | Out-Null
$objSearcher.PropertiesToLoad.Add("member") | Out-Null

$colResults = $objSearcher.FindAll()
foreach ($objResult in $colResults){
    $objItem = $objResult.Properties;
    Write-Output $
    foreach ($objMember in $objItem.member) {
        Write-Output "   $objMember"
share|improve this answer
I made one small change to output the Distribution List on the same line as the user: foreach ($objResult in $colResults){ $objItem = $objResult.Properties; foreach ($objMember in $objItem.member) { Write-Output "$($,$($objMember)" } } – Rob Burke Jul 13 '10 at 15:53

Or if you'd rather use the Powershell that comes with Exchange, here is an alternate script. It'll

 # dump all DLs to a variable, whether DistributionList or mail-enabled Sec-group
 $DLList = get-distributiongroup
 # Iterate over each DL to get member-list
 foreach ($DL in $DLList) {
     # Get the member list
     $Dmember=get-distributiongroupmember $DL
     # Get DL name
     # Start outputting
     write-output "`q$Dname`q" -nonewline
     # Iterate over member list, outputting
     foreach ($Member in $Dmember) {
         write-output ",`q$MName`q" -nonewline
     # Add terminal line-feed
     write-output "`n"

This should produce output that looks like:

 "Accounting","Mary Joe","Fred Smith"
 "Receiving Office"
 "Office, home","John Birtram"

Adust however you need to.

This script came largely off the top of my head and probably contains bugs.

share|improve this answer

I've accepted Torai's answer as it was the one I used but I made a small change in the foreach look to have it output the Distribution List on the same line as the User data:

foreach ($objResult in $colResults){
    $objItem = $objResult.Properties;
    foreach ($objMember in $objItem.member) {
        Write-Output "$($,$($objMember)"
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.