Assume I have a distribution group in Exchange which currently exists, and holds about 20 members.

In Powershell 2, I have acquired a list of about seven hundred more individuals who need to be added to the group. The only way I have been able to do this is one user at a time:

Add-DistributionGroupMember -Idneity GROUP-NAME -Member Member1
Add-DistributionGroupMember -Idneity GROUP-NAME -Member Member2
Add-DistributionGroupMember -Idneity GROUP-NAME -Member MemberN

Is there a mechanism available that allows me to add all users with just one function call, as represented by the following pseudo-code?


I'm not looking for loop constructs. I'm looking for a function or cmdlet that can add all members at once, ideally taking only one argument referencing the entire list. I'm scared to think what Powershell would do with 700+ command-line arguments...

(I'm hoping that if this IS possible, that I can pass an array or collection of objects to be added.)

Any suggestions? I don't see a command called 'set-distributiongroupmember', and I also don't see anything promising in 'set-distributiongroup'.


I'm not sure why you don't want to use a loop construct; that's kinda one of the major features of PS. A simple:

Import-CSV FileName.csv | ForEach {Add-DistributionGroupMember -Identity "GROUP-NAME" -Member $_.Name}

would easily do the trick. Failing that, though, there's no cmdlet to do exactly what you want. You could do a

Remove-DistributionGroup GROUP-NAME; New-DistributionGroup -Name GROUP-NAME -Members memberlist

but that's a little cheesy.

  • The reason I don't want to use a loop construct is that I have empirical evidence that suggests performing one call to interact with a distribution group is orders of magnitude faster than making the same call to interact with a distribution group hundreds of times. It's about performance, which a loop construct doesn't give me. It's pretty sad and inconsistent that new-distributiongroup lets you specify a list argument, but add-distributiongroup doesn't. – Larold Sep 28 '11 at 20:54
  • What is this evidence? I'd be curious to see if what you did was a true "apples-to-apples" comparison. I'd like to run the test myself. – pk. Sep 28 '11 at 21:24
  • Gather a list of 1,000 email addresses. Create mail contacts for them. Then add them to a distribution group one at a time with add-distributiongroupmember. Then, for comparison, make a call to new-distributiongroup with 1,000 of those contacts in the single array argument. Additionally, try calling get-distributiongroupmember one member at a time for a whole group, then try returning everyone at once. In short - every call that connects to AD or Exchange produces significant overhead. That's why I only want one call to add everyone in my array. – Larold Sep 29 '11 at 1:42
  • 1
    My results: Add-DistributionGroupMember x 1000 : 2m 13s --- New-DistributionGroup $arrayof1000Contacts : 17s = significant enough difference to care – pk. Sep 29 '11 at 14:15
  • @pk - thanks for confirming. That's why I'm dying for functionality to pass an array to add-distributiongroup, just like you can pass to new-distributiongroup. Definitely something MS should consider in future releases. – Larold Sep 29 '11 at 14:43

Successfully populated a Distribution Group by creating a text file, populating with member account aliases, then executing the command:

% Get-Content <path\filename.txt> | Add-DistributionGroupMember "<Display Name of Distribution Group>"

See these URLs for further details:


Try this, it seems to work for me:

Get-Content | Add-DistributionGroupMember

Text file just contains the aliases of the users that you want to add.

  • will fail on user who is already a member – filimonic Jan 31 '15 at 4:20

Not sure why the teams at Microsoft made this so complicated. Sometimes you just have to think simple.

"user1","user2","user3" | Add-DistributionGroupMember -Identity "SomeMailbox"

It looks like the Quest Active Directory PowerShell Cmdlets can add multiple users to a group at one time per this wiki page. In my brief testing, I was able to use the Add-QADGroupMember cmdlet to add a small array of users to a test group in Active Directory.


It might be helpful too to add AD with this:

import-module ActiveDirectory

Then just use:

Add-AdgroupMember MyList -member user.alias,user2.alias,user3.alias,...

For this you do need RSAT installed (MS product, and free) or it won't work.

  • 1
    How does this solve the problem of the manual repetition the OP is interested in avoiding? – squillman Nov 19 '14 at 17:29

If performance is a concern Add-ADGroupMember is by far the fastest, and as mentioned can take an array as input to the -Member parameter.

  • Add-ADGroupMember will break on adding a member already in group – filimonic Jan 31 '15 at 4:45

Something like that, not sure if this is well-written or working - just an idea.

Function Add-DistributionGroupMembers_Safe {
Param (
    $local:groupADSI = [ADSI]"LDAP://${$(Get-DistributionGroup -Identity $Identity).DistinguishedName}"
    $local:DGUsers = @( @( Get-DistributionGroupMember -Identity $Identity ).Name )
    $local:UsersToAdd = @( $Member | Where-Object { $local:DGUsers -notcontains $_ } | ForEach-Object { return (Get-ADUser -Name $_}).DistinguishedName )
    ForEach ($user in $local:UsersToAdd) {
        try {
            $local:GroupADSI.Properties["member"].Add($user) | Out-Null
        } catch {
            #Error processing, text in $_.Exception.Message

For adding bulk users from text file use the below script, it is very easy to use and this guy has written pretty neat


  • 1
    you might want to add the relevant part of the script, show perhaps which features it uses so one can create an own script. given that the link might not work some time in the future your answer will not help if the link breaks. – Dennis Nolte Mar 12 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.