Office 365: How to Create a Distribution List using PowerShell?

What is a Distribution List in Office 365?

A distribution list in Office 365 is a collection of email addresses used to send email messages to several recipients simultaneously. An administrator or any user with the appropriate permissions may create this type of group. Any email sent to a distribution list is automatically forwarded to all the email addresses on the list. This can be useful for sending messages to multiple people at once, without manually entering each recipient’s email address.

Difference between Office 365 Groups and distribution list

Both Office 365 Groups and distribution lists are used for communication and collaboration among members of a group, but there are some key differences between them:

  1. Functionality: Office 365 Groups provide a greater level of functionality than distribution lists. In addition to email distribution, Office 365 Groups can be used to share calendars, task lists, OneNote notebooks, and SharePoint sites. They also have a group mailbox and a shared team workspace in Microsoft Teams.
  2. Membership: Office 365 Groups have a membership management system that allows members to join and leave the group at their discretion. On the other hand, distribution lists require an administrator to manage membership.
  3. Collaboration: Office 365 Groups are designed to facilitate collaboration and teamwork, while distribution lists are used primarily for one-way communication. Using Office 365 Groups, members can collaborate on projects and share files in real time.
  4. Access Control: In Office 365 Groups, access control options are granular, allowing owners to set permissions for specific members or groups of members. It is not possible to control access to distribution lists in this manner.
  5. Integration: Office 365 Groups integrate with other Microsoft apps and services, such as Microsoft Teams, SharePoint, and OneDrive for Business. Distribution lists do not have this level of integration.

The bottom line is that although Office 365 Groups and distribution lists serve similar purposes, Office 365 Groups provide greater functionality, collaboration, and access control options, and are designed to facilitate teamwork and collaboration in the modern workplace.

How to create a distribution list in Office 365?

Distribution lists can be used to manage groups of users or contacts within an organization. You can create them based on a variety of criteria, including department, team, project, or location. For example, a distribution list might be made for the marketing department, which includes all the email addresses of the marketing team members. The Office 365 admin center or PowerShell can be used for creating and managing distribution lists.

Create a Distribution Group using Microsoft 365 Admin Center

A distribution list is a group of email addresses used to send messages or collaborate on projects. Let’s walk through the step-by-step process of creating a distribution list in Office 365.

Step 1: Sign in to the Office 365 admin center

The first step in creating a distribution list is to sign in to the Office 365 admin center with your admin credentials. You will need to have Office 365 admin permissions to create a distribution list.

Step 2: Navigate to the Groups section

In the left navigation menu of the admin center, select “Teams & Groups” to access the “Active Teams & Groups” link. This section contains all the groups created in your organization, including distribution lists, security groups, and Microsoft Teams.

Step 3: Create a new distribution list

To create a new distribution list, click the “Add a group” button under the “Distribution list” tab. This will open a wizard where you can enter the distribution list configurations.

add distribution list in office 365

Choose “Distribution” as the group type.

create distribution list in office 365

Step 4: Enter the group name and description

Next, enter a name for the distribution list in the “Name” field. This name will be used to identify the group when you send messages or collaborate on projects. You can also enter a description for the distribution list in the “Description” field, although this is optional.

How to create a distribution group in office 365

Step 5: Add the Owner and members to the distribution list

Once you have entered the group name and description, you can add owners and members to the distribution list. Click the “Add Owners” button to open a panel to select the users or contacts you want to designate as Owners. You can search for users or contacts by name or email address and select them from the list.

assign distribution group owner

Add members to the distribution list by clicking on the “Add members” button and selecting the users or contacts you want to include in the list.

add ditribution list members

Step 6: Set the Group Email Address

Assign an Email address for the Distribution List. This will be used in Email clients like Outlook. You can also set if the distribution list should allow external senders.

set distribution group email address

Step 7: Finish Creating the Distribution List

Once you have entered all the necessary information and added members to the distribution list, click on the “Create group” button to create the distribution list.

How to add new distribution list in office 365

Once the distribution list is created, you’ll get the “Group created” page. The distribution list will be created and added to the list of groups in the Groups section.

office 365 distribution list

Now, you can manage its settings by clicking on the group name in the list of groups. From here, you can add or remove members, manage permissions, and customize the list’s settings to meet your needs.

Create a distribution list in Office 365 using PowerShell

To create a distribution list in Office 365 using PowerShell, you can use the New-DistributionGroup cmdlet in Exchange Online Management Shell. Make sure Exchange Online PowerShell Module is installed before running this script!

#Parameters
$Name = "Marketing Managers"
$Alias = "MarketingMgrs"
$EmailAddress = "MarketingManagers@Crescent.com"
$DLMembers = @("GradyA@Crescent.com", "IsaiahL@Crescent.com","AdeleV@Crescent.com")

#Connect to Exchange Online
Connect-ExchangeOnline -ShowBanner:$False
 
#Create a new Distribution List
New-DistributionGroup -Name $Name -Alias $Alias -PrimarySmtpAddress $EmailAddress -Members $DLMembers -Type Distribution

You can also create a Distribution List and add members to it later!

#Create a new Distribution List
New-DistributionGroup -Name "Sales Managers" -Alias "SalesMgrs" -PrimarySmtpAddress "SalesManagers@Crescent.com" -Type Distribution

#Add a Member to the Distribution List
Add-DistributionGroupMember -Identity "SalesManagers@Crescent.com" -Member "AdeleV@Crescent.com"

#Add Multiple Members
$Members = @("GradyA@Crescent.com","IsaiahL@Crescent.com","CredeS@Crescent.com")

$Members | ForEach-Object {
    Add-DistributionGroupMember -Identity "SalesManagers@Crescentcom" -Member $_
    Write-Host "Added Member:"$_
}

Use the “Type” parameter as “Security” to create a Mail-enabled security group. Administrators can use this method to automate the creation of distribution lists or to manage a large number of distribution lists across a company.

PowerShell Script to Bulk Create Distribution Groups from a CSV File

Let’s create multiple distribution lists in Office 365 using PowerShell from CSV. Here is my CSV template:

create distribution list in office 365 powershell csv
#Parameters
$CSVFilePath = "C:\Temp\Bulk-DL.csv"

Try {
    #Connect to Exchange Online
    Connect-ExchangeOnline -ShowBanner:$False

    #Get Data from CSV and Create Distribution List
    Import-CSV $CSVFilePath | ForEach {
        New-DistributionGroup -Name $_.Name -PrimarySmtpAddress $_.Email -Type $_.Type -Members $_.Members.split(",")
        Write-host -f Green "Created Distribution List:"$_.Name
    }
}
Catch {
    write-host -f Red "Error:" $_.Exception.Message
}

You can download the template here:

Conclusion

To conclude, creating a distribution list in Office 365 can be a simple and effective method of managing groups of contacts or users. PowerShell or the Office 365 admin center can be used to create distribution lists, and they can be customized to meet the specific needs of the organization. By leveraging PowerShell, you can automate the creation of large numbers of lists. Additionally, bulk creation of distribution lists can be achieved by using a CSV file to import the necessary information. It is simple to create a distribution list and add members to it by following the steps outlined above.

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

One thought on “Office 365: How to Create a Distribution List using PowerShell?

  • Hi Salaudeen –
    Thank you for the script.. I am running into the following. Am I missing something?

    Write-ErrorMessage : Object reference not set to an instance of an object.
    At C:\Users\***\AppData\Local\Temp\tmpEXO_yqwrdyhi.pre\tmpEXO_yqwrdyhi.pre.psm1:1159 char:13
    + Write-ErrorMessage $ErrorObject
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [New-DistributionGroup], Exception
    + FullyQualifiedErrorId : [Server=MW4PR17MB5483,RequestId=d0c15854-5969-3855-2095-91286e251c89,TimeStamp=Mon, 07 Aug 2023 21:04:48 GMT],Write-ErrorMessage

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *