Created
November 29, 2017 00:59
-
-
Save chrisbrownie/e74d0815a5eba0c6cf77be3ba7072a8b to your computer and use it in GitHub Desktop.
Returns the membership of all Exchange Online Distribution Groups
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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