Exchange 2007 export all distribution groups

In some situations it’s verry usefull to have an export of all the available distribution group in your Exchange 2007 environment. With the following script you can export alle the distribution groups with there Name, Alias, SMTP address and secundary SMTP addresses.

—————————————————————————————————
Get-DistributionGroup | select name , alias ,EmailAddresses | foreach {
  “Name: “+$_.name
  “Alias: “+$_.alias
   $_.EmailAddresses | foreach {
     if($_.SmtpAddress){
     “SmtpAddress: “+$_.SmtpAddress
   }
}
write-host
}
—————————————————————————————————

When you copy and past this code in notepad and save it as Get_Dis.ps1 , you get the following export for example:

Name: Exchange Team
Alias: ExchangeTeam
SmtpAddress: Exchange2003Team@e2k7.local
SmtpAddress: Exchange2007Team@e2k7.local
SmtpAddress: ExchangeTeam@e2k7.local

Name: ICT Helpdesk
Alias: ICTHelpdesk
SmtpAddress: Helpdesk@e2k7.local
SmtpAddress: ICTHelpdesk@e2k7.local

Name: ICT Management
Alias: ICTManagement
SmtpAddress: ICTManagement@e2k7.local

Leave a Reply