Export all distribution lists from on-premise Exchange and Exchange Online

Steel Contributor

Hi all

Hope everyone is well.

 

We are in the midst of a migration and I need to export all distribution lists from our Exchange on-premise environment and Exchange Online.

 

What's the best way to do this?

 

Appreciate any advice.

3 Replies
Hi Navishkar Sadheo,
First I need to ask some questions.
What do you want to achieve with the exported data?
Do you want to use the exported data for creating the same DLs in another environment, or is it "just" for documentation purposes?
-Thomas
Hi Thomas.

We need to recreate the dist lists in the new tenant.

@Navishkar Sadheo 
Seven Zhou provides a solution for such a request in this post

You can run the same cmdlets in step 2 from that approach in an on-premises Exchange organization as well. 

 

Quote

  1. Open Windows PowerShell and connect to Exchange Online PowerShell. Here are the commands:

    Install-Module ExchangeOnlineManagement (Enter Y to install the module)
    Connect-ExchangeOnline (Sign in using an admin account and password)

  2. Then run the following script to get a CSV file about Distribution list.

$Groups = Get-DistributionGroup

$Groups | ForEach-Object {

$group = $_.Name

$members = ''

Get-DistributionGroupMember $group | ForEach-Object {

$members=$_.Name

New-Object -TypeName PSObject -Property @{

GroupName = $group

Members = $members

EmailAddress = $_.PrimarySMTPAddress

}}

} | Export-CSV "C:\DistributionGroupMember.csv" -NoTypeInformation -Encoding UTF8

 

Use the exported CSV file as an input file for creating the distribution list in the new EXO tenant.

-Thomas