Skip to content

Instantly share code, notes, and snippets.

@chrisbrownie
Created November 29, 2017 00:59
Show Gist options
  • Save chrisbrownie/e74d0815a5eba0c6cf77be3ba7072a8b to your computer and use it in GitHub Desktop.
Save chrisbrownie/e74d0815a5eba0c6cf77be3ba7072a8b to your computer and use it in GitHub Desktop.
Returns the membership of all Exchange Online Distribution Groups
$allDistributionGroups = Get-DistributionGroup -ResultSize unlimited
$allGroupMemberships = $allDistributionGroups | ForEach-Object {
$thisGroup = $_
Get-DistributionGroupMember -Identity $thisGroup.Identity |
Select-Object `
@{Name="GroupIdentity";Expression={$thisGroup.primarySmtpAddress}},
@{Name="MemberAddress";Expression={$_.PrimarySmtpAddress}}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment