Report on your Office 365 Distribution Groups

Scenario description

Distribution groups are used within organizations to create e-mail distribution lists.

Distribution groups can be used only with e-mail applications such as Microsoft Outlook to send e-mail messages to collections of users.

This script will export the list of distribution groups in your Office 365 organization into a CSV file.

Report on your Office 365 Distribution Groups

To begin, you will need to connect to Microsoft Exchange Online.
$credential = Get-Credential
$ExchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $credential -Authentication Basic -AllowRedirection
Import-PSSession $ExchangeSession
This command is used to get the list of existing distribution groups.
Get-DistributionGroup
To export the results into a CSV file, you can run the following command. You can replace the C:\reports\distribution_group.csv with a location and file name of your choosing.
Get-DistributionGroup | Export-Csv C:\reports\distribution_group.csv
Comments

No Comments