Distribution lists in Office 365 – administration tips

[Update]: This post was originally published on April 16, 2019. There have been significant changes concerning upgrades from Distribution Lists to Office 365 Groups or Microsoft 365 Groups.

Distribution lists are known under a few different names. Distribution groups, contact groups and distribution lists – all refer to the same feature. The primary purpose of a distribution list is to send emails to multiple recipients – yes, as simple as that. The simplicity of their design and the idea behind distribution groups make them an essential email feature. It’s no wonder they have been around since the earliest versions of Exchange Server and that they can be found in Office 365 (Microsoft 365), as well. Although they have survived in a very similar form, Office 365 also offers a redesigned variant of distribution lists – Office 365 Groups.

Distribution lists in Office 365

By the way, Office 365 Groups and Microsoft 365 Groups are the same thing. Officially, they’re called Microsoft 365 Groups after a rebranding, but most people use the old name. You can voice your doubts in the comments if you like.

Office 365 focuses on using the upgraded version of distribution groups – Office 365 Groups. I will start with a quick comparison between the two features. Later on, I will describe a few common administration tasks concerning Office 365 distribution lists.

Distribution lists and Office 365 Groups

In Office 365, distribution lists are slowly losing ground because of Office 365 Groups. The great thing about Groups is that they can serve the very same purpose and have many additional features. They integrate not only with Outlook, but also with SharePoint, Viva Engage, OneNote and other Office 365 services. So is there a reason to use distribution groups if you can have their upgraded version? It depends.

Office 365 Groups are great for collaboration. Having an automatically-generated SharePoint site collection and integration with other Office 365 features helps users work with each other. However, while a Group is great for particular teams or projects, is it always something worth setting up? There are situations in which you simply want to send emails to a certain collection of contacts. What is the point of cluttering your SharePoint with ghost sites no one will ever use? Dealing with inactive distribution lists is enough of an administrative problem.

If you want to learn more about similarities and differences between the two, take a look at: in-depth comparison between Office 365 Groups and Distribution lists.

The fact is, it does not really matter if Office 365 Groups are a better solution or not. Distribution lists still can be found in every Office 365 organization, so it is good to know what exactly you are working with. Especially because there are some distribution lists which you cannot upgrade to Groups.

Distribution list limits in Office 365

There are a few limits which apply to Office 365 distribution groups that you should be aware of:

  • member count for a distribution list: 100,000 (50,000 for organizations using AAD Connect, 15,000 if there is a slightly outdated DirSync in place).
  • number of groups created by a single user/admin: 300,000.
  • number of distribution group owners: 10.
  • size for messages sent to groups with 5,000-99,999 members: 25MB.

The limits apply to all Office 365 subscriptions, it does not matter if you have Office 365 Business Essentials, or Office 365 Enterprise E5 subscription – the limits stay the same. The only difference is if you have Exchange Online as a standalone option. In this case, each plan allows one user to create up to 250 instead of 300,000 distribution groups.

A complete list of distribution group limits is available here.

As you can see, those limits are not real roadblocks in most cases. Together with the fact that contact groups can be user-created, it unfortunately means that cleaning those lists might be a common and repetitive task for each admin.

How to create a new distribution list

To create a new distribution list, connect to Exchange Online with PowerShell and use the New-DistributionGroup cmdlet. For example,

New-DistributionGroup -Name “TestGroup”

creates a universal distribution list called TestGroup, with the [email protected] SMTP address. That’s the most basic form of the cmdlet, but you can do much more by using additional parameters. I’ll describe the most common ones:

  • -Members lets you automatically add a list of email addresses to a newly created DL. You can add multiple addresses – just separate them with commas. After creating a group, you can still use Add-DistributionGroupMembers to add new email addresses.
  • -ManagedBy lets you specify owners of the group. By default, the admin who creates the group automatically becomes its owner. Group owners can modify group properties and manage its members,
  • -PrimarySmtpAddress lets you control the email address of the distribution list. If not specified, the Alias parameter is used to generate the address.
  • -HiddenGroupMembershipEnabled lets you hide members of the group from others. The parameter can be used only when creating a group and cannot be changed afterwards.

How to find & delete inactive distribution lists in Office 365

What is an inactive distribution list? It is a list to which nobody sends any emails. Sometimes, they are created for test purposes or by mistake (and forgotten about), sometimes they are simply created not to be used, ever. An empty distribution list is a list with no members. It is a good practice to remove both empty and inactive groups as to keep the organization and GAL clean. Although both inactive and empty distribution lists are similar, the way to deal with them is not quite similar.

Now, there is a slight problem with finding inactive distribution lists in Office 365. Normally, back in the old, on-prem days, you could search through message tracking logs to see which distribution lists are in use. What is more, since on the on-prem Exchange the logs are also physical text files, there is no problem in keeping them for as long as you want and even backing them up. As a result, with the right configuration, you could very easily make sure if a distribution group has ever been used. In Office 365, it is not as simple as that. Office 365 Message Trace works differently.

Mind to connect to Exchange Online with PowerShell before running any cmdlets. Message trace can show results from the last 10 days. Since the “expanded” message status is reserved for distribution lists, it can be used to limit the results to those groups only:

Get-MessageTrace -Status expanded -startdate (get-date).AddDays(-10) -EndDate (Get-Date) | group recipientaddress | select name,count

The cmdlet above returns all messages sent to distribution lists, groups them, and displays the message count. The problem is, this method of determining inactive groups is not that reliable. Not using a distribution group for ten days does not make it completely inactive, yet. Theoretically, you could use the Historical Search feature to search for the messages sent in the last 90, and not 10 days. Unfortunately, Start-HistoricalSearch requires either sender, recipient, or messageid attribute to run successfully. Checking all senders manually is not an option, and checking each recipient (distribution list) separately seems counterproductive.

As a workaround, you can run message trace periodically and create your own message tracking log.

How to trace inactive distribution lists manually

The cmdlet below gets all messages sent to distribution groups in the last 10 days and exports the most basic information to a CSV.

Get-MessageTrace -Status expanded -startdate (get-date).AddDays(-10) -EndDate (Get-Date) |select received,recipientaddress,status| Export-Csv C:\SentToDL.csv -Append

If you run this script every 10 days, you will be able to log all email sent to distribution lists.

To learn how actively users send to distribution lists, run:

import-csv C:\Users\a.lewis\dist2.csv | group recipientaddress | select name,count

The cmdlet returns DL addresses together with a number of emails sent to them. Still, all the data up to now is about active distribution lists. To find out which of the distribution lists in your organizations are inactive, run the following:

$ActiveDL = (import-csv C:\SentToDL.csv | group RecipientAddress).name;
$allDL = (Get-DistributionGroup).PrimarySMTPAddress;
$inactive = $AllDL | where {$activeDL -notcontains $_};
$inactive

You will receive a list of all distribution lists nobody has sent emails to. Mind that the results depend on how long you have been keeping your manual message tracing. What is more, the $inactive variable will include contact groups which have just been created. Therefore, it might be a good idea to delete groups which are listed more than once.

How to find & delete empty distribution lists in Office 365

Finding empty distribution lists, on the contrary, is a quick and easy task. Once you establish remote connection to your Office 365 tenant, run the following cmdlet:

get-distributiongroup |? {!(get-distributiongroupmember $_.PrimarySMTPAddress).count}

This one-liner returns all empty distribution lists. To delete them, pipeline the results to Remove-DistributionGroup:

get-distributiongroup |? {!(get-distributiongroupmember $_.PrimarySMTPAddress).count} | Remove-DistributionGroup -WhatIf

the -WhatIf switch only shows you which distribution groups will be deleted. To actually delete them, replace -WhatIf with -Confirm:$false.

Upgrade distribution lists to Office 365 Groups

UPDATE February 10, 2023

According to this article on Exchange Team blog and MC455545 from Message Center, it is not possible to upgrade a DL to Office 365 Group after February 01, 2023. My tenant didn’t get the memo, though and I’m still able to upgrade DLs from EAC and PowerShell. What’s more, a separate message, MC510333, suggests that not only it is still possible to do the upgrades, but also a new upgrade method is being developed. Take a look at the screenshot borrowed from the Message Center:

How to upgrade distribution lists to O365 Groups

The image suggests that, for the time being, the direct upgrade might still be possible. Apart from that, a Microsoft 365 admin will be able to send an upgrade request to a distribution group owner.

If the upgrade option is removed after all, the instructions below will no longer be valid. If that’s the case, the Migrate a distribution group to Office 365 section shows how to perform a manual upgrade.

If you decide you want more from your distribution lists, you can always upgrade them to Office 365 Groups. You can do it with a single cmdlet: Upgrade-DistributionGroup. There is a catch, though – a distribution list has to fill certain requirements. You can check which of distribution lists in your company can be upgraded with Get-EligibleDistributionGroupForMigration. You can find some of the reasons why a distribution list cannot be upgraded, below:

  • Distribution groups managed on premises. It means that if you have a directory synchronization in place, you will have to recreate a group in Office 365 before you upgrade it.
  • Nested distribution groups. A distribution list cannot have another distribution group as its member, and cannot be a member of other groups.
  • Distribution lists without owners.
  • Dynamic distribution lists & security groups.

For a complete list of distribution groups which are not eligible for upgrade, visit this article.

One way to deal with non-upgradable groups is to create them directly in your target tenant. If you want to recreate distribution lists in Exchange Online, you need to migrate them.

Migrate a distribution group to Office 365

Distribution list migration is an elaborate name for exporting and then importing them, along with their member lists. To export distribution group members to a CSV file, run the following cmdlet:

Get-DistributionGroupMember "DistributionGroupName" | Export-Csv dl.csv

The cmdlet will create a CSV file in your current location. If a group contains nested lists, it is a good idea to export their members directly into the target CSV.

Get-DistributionGroupMember "DistributionGroupName" | where recipienttype -eq "UserMailbox" | export-csv nested.csv -Append;
$nested = (Get-DistributionGroupMember "DistributionGroupName” | where recipienttype -ne "UserMailbox");
foreach ($list in $nested)
{Get-DistributionGroupMember $list.PrimarySmtpAddress | export-csv nested.csv -append}

This short script will add all distribution list members, including those from nested groups, directly to the CSV file of your choosing. After that, if you want to create a new distribution list and import members in bulk, first create the group and assign its owner:

New-DistributionGroup "Example" -ManagedBy "Admin"

After that, use the CSV file you created earlier to populate the new group:

$dlmembers = import-csv testers.csv
foreach ($dlmember in $dlmembers) {Add-DistributionGroupMember "Example" -member $dlmember.PrimarySmtpAddress}

As a result, you will recreate a distribution list in the target tenant.

Useful articles:

Tools for Microsoft 365

4 thoughts on “Distribution lists in Office 365 – administration tips


  1. Hi Adam, can we use content search to find emails received by all the Distribution lists and export a report for the past 3 months?

    • Content search? I don’t think so. Distribution lists don’t store any emails, so content search won’t return any results. However, you could use message tracking (historical search) to search for emails sent to distribution lists.

  2. Under the ‘How to find & delete inactive distribution lists in Office 365’ section the author mentions the limitations of the ‘Get-HistoricalSearch’ command. I would have thought the ‘Start-HistoricalSearch’ command would have been more appropriate for this task ?

    • Thank you for bringing this to my attention, Start-HistoricalSearch is what I had in mind. I have just changed the verb.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

CodeTwo sp. z o.o. sp. k. is a controller of your personal data.
See our Privacy Policy to learn more.