List Distribution Groups in Office 365 Powershell

We can get all the office 365 distribution groups by using the powershell cmdlet Get-DistributionGroup. Before proceed, Connect Exchange Online Remote PowerShell.

The below command select and lists all the office 365 distribution groups.

Get-DistributionGroup | Select DisplayName,GroupType,PrimarySmtpAddress

List Distribution Group Members

We can use the powershell cmdlet Get-DistributionGroupMember to find and list office 365 distribution group members.

Get-DistributionGroupMember -Identity '<group_name>'

The following powershell command list all the distribution group members.

$Groups = Get-DistributionGroup
$Groups | ForEach-Object {
$group = $_.Name
Get-DistributionGroupMember $group | ForEach-Object {
      New-Object -TypeName PSObject -Property @{
       Group = $group
       Member = $_.Name
       EmailAddress = $_.PrimarySMTPAddress
       RecipientType= $_.RecipientType
}}}
Advertisement

Leave a Comment