none
Exchange 2007 Powershell script to find all distribution groups with smtp addresses of each member RRS feed

  • Question

  • We are migrating to Google apps and am using flash panel to import our user groups.

    There is a spread sheet that needs:

    Group email address, Group Name and email addresses of each memeber in a csv format.

    Each member needs to be separated by a |

    Can anyone help?

    Friday, January 31, 2014 10:40 AM

Answers

  • This is extremely ugly but this is from memory only...

    Set-ADServerSettings -ViewEntireForest $True
    
    ForEach ($X in (Get-DistributionGroup)){$Z = Get-DistributionGroupMember -Identity $X ; ForEach ($Y in $Z){Write-Host "$($X.DisplayName) | $($X.PrimarySmtpAddress) | $($Y.PrimarySmtpAddress)"}}
    

    Save the contents to a file and save as csv. Of course, you can look at doing an export-csv using the delimiter option directly.

    • Marked as answer by ParisV Monday, February 3, 2014 2:27 PM
    Friday, January 31, 2014 7:03 PM

All replies

  • This is extremely ugly but this is from memory only...

    Set-ADServerSettings -ViewEntireForest $True
    
    ForEach ($X in (Get-DistributionGroup)){$Z = Get-DistributionGroupMember -Identity $X ; ForEach ($Y in $Z){Write-Host "$($X.DisplayName) | $($X.PrimarySmtpAddress) | $($Y.PrimarySmtpAddress)"}}
    

    Save the contents to a file and save as csv. Of course, you can look at doing an export-csv using the delimiter option directly.

    • Marked as answer by ParisV Monday, February 3, 2014 2:27 PM
    Friday, January 31, 2014 7:03 PM
  • Thanks very much, very useful.

    Monday, February 3, 2014 2:28 PM