add bulk of members in CSV file to DL via PowerShell

IT 140 Reputation points

I am looking for a power shell command to add bulk of users into DL (Exchange Online). I have a CSV file contain the users and email address.

I appreciate your kind help

Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,358 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,449 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rich Matheisen 45,671 Reputation points

    Now that you have (or will have) a usable CSV file (

    Import-Csv tt.csv |
        	Add-DistributionGroupMember -identity "DL Identity Goes Here" -member $_.Email
    1 person found this answer helpful.

3 additional answers

Sort by: Most helpful
  1. Kael Yao-MSFT 37,676 Reputation points Microsoft Vendor

    Hi @IT,

    If the format of csv file is like:


    You can run the following script to bulk add users:

    (replace $member.Email with the corresponding column header in your csv file, for example if the header is "EmailAddress", you need to use $member.EmailAddress)

    $members = import-csv users.csv
    foreach($member in $members)
    	Add-DistributionGroupMember -identity "DL email address" -member $member.Email

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

  2. Rich Matheisen 45,671 Reputation points

    If the screenshot of your "csv", viewed in Excel, looks like below, then expand the width of column "A" and I think you'll see that all of your data are in only one column.

    User's image

    If you exported that to a CSV format you'd have a text file that looks like this:


    If you were to import that using Import-CSV you'd get PSCustombjects with only one property: Name,Email and, as a value for that property you'd see "ParentUK1","".

    As a result, there's no "Email" property, nor a "Name" property.

    If all of that is not what you're dealing with, then we need to see the contents of (say) the first three lines of the file "tt.csv". You can use Get-Contents tt.csv | select-object -first 3 to do that.

  3. IT 140 Reputation points

    Kindly find the result

    User's image