Find All Distribution Groups and their Members in Exchange Org

Get-DistributionGroup –ResultSize Unlimited | FL Identity | Out-File C:TempAll_DGs.txt

$AllDGs = Get-Content "D:TempAll_DGs.txt"
ForEach ($DG in $AllDGs)
{
Echo $DG >>"D:TempAll_DG.csv"
Get-DistributionGroupMember –Identity $DG -ResultSize Unlimited | FT Name, PrimarySMTPAddress, RecipientType >> "D:TempAll_DG.csv"
}

 

I know this simple script can be even better but it was written in extreme hurry so it does have some extra lines. If you feel that it could be really better then please feel free to comment with your own idea. 🙂

3 thoughts on “Find All Distribution Groups and their Members in Exchange Org”

Comments are closed.