Back to script samples page
Get a list of all the distribution groups in the organization

You can use distribution groups 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.

#Get a list of all the distribution groups in the organization.

#Connecting to Exchange Online.

#Capture administrative credential for future connections.
$credential = get-credential

#Creates an Exchange Online session.
$ExchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $credential -Authentication Basic -AllowRedirection

#Import session commands.
Import-PSSession $ExchangeSession 

#Get a list of all the distribution groups in the organization.
Get-DistributionGroup
Downloaded 0 times
- - - - - (0)
Comments