add users to DL

Glenn Maxwell 10,146 Reputation points
2020-12-17T05:49:21.82+00:00

Hi All
i have 10000 users in csv file i want to add them to a DL and i am able to add them using the below syntax, but i am only able to add 1000 users. i need to execute this 10times. is there a way that i can add 10000 users at a time.

Import-CSV C:\list.csv | ForEach {Add-DistributionGroupMember -Identity dl@Company portal .com -Member $_.users}

Microsoft Office Online Server
Microsoft Office Online Server
Microsoft on-premises server product that runs Office Online. Previously known as Office Web Apps Server.
587 questions
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,210 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,369 questions
{count} votes

Accepted answer
  1. Joyce Shen - MSFT 16,646 Reputation points
    2020-12-18T02:07:57.28+00:00

    Hi @Glenn Maxwell

    Agree with the suggestions above from AshokM, we can use the Update-DistributionGroupMember to meet this requirement

    Here is also a related thread discussed about this similar question as yours: Add multiple members to distribution group with one call?

    $NewMembers = Get-Content <path to member list text file>  
    $CurrentMembers = (Get-DistributionGroupMember -Identity GroupName).PrimarySmtpAddress | where {$_ -ne ""}  
    $NewMemberList = $CurrentMembers + $NewMembers  
    Update-DistributionGroupMember -Identity GroupName -Members $NewMemberList -Confirm:$false  
    

    If an Answer is helpful, please click "Accept Answer" and upvote it.

    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.
     

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Ashok M 6,506 Reputation points
    2020-12-17T06:28:55.577+00:00

    Hi,

    This command looks good and it should work. Could you please let us know what exactly happens when you initiate this command for 10000 users. Any error messages?

    Also, are you able to get that 10000 names when you run Import-CSV C:\list.csv?

    You can also try using Update-DistributionGroupMember, but this will replace the current members of the DL. So, get the current members using Get-DistributionGroupMember and update the membership using the same CSV.