Exchange Power Shell to add users to a Distribtuion Group

Posted on 2009-04-05
Last Modified: 2012-06-21
I am looking for a PowerShell script that will allow us to add users in bulk to a Distribution Group. We were able do the DG addistion in bulk but now we need to add the users.
Question by:jwhitepnv
  • 2

Accepted Solution

crimmel earned 500 total points
ID: 24073816
I highly recommend doing this using Quest's Active Roles Management Shell for AD.  You can download this from here:

The commands in this management shell are infinitely easier than the ones required when using the basic Powershell from Microsoft.

Anyway, once you get these installed, create a csv file called "userlist.csv" with a list of all of your users (I would recommend using the samaccountname).  Then copy and paste the code below into a file titled "addgroupmembers.ps1".  Run the script to add members to a group by running ".\addgroupmembers.ps1 userlist.csv" from within the Quest Active Roles Mgmt Shell.

$users = get-content List of users
Foreach($user in $users)
	Add-qadgroupmember Identity CN=GroupName,OU=OUName,DC=DCName Member $user

Open in new window


Expert Comment

ID: 24073858
For some reason, the quote marks in the original code snippet above were dropped and may cause problems for you.  Use the following as I have removed the quotes and run it by typing simply ".\addgroupmemers.ps1".  Be sure to place the csv file in the correct location or point the get-content command to the correct location:

$users = get-content c:\scripts\userlist.csv

Foreach($user in $users)
      Add-qadgroupmember Identity CN=GroupName,OU=OUName,DC=DCName Member $user

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This video discusses moving either the default database or any database to a new volume.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question