• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 601
  • Last Modified:

Adding a list of users in Distribution list using power shell script

Hi All,

I am running Windows Server 2008 and I need to create a DL in Exchange 2010

Is any way I can add a 100 users to DL using a script to do that
Please help me with step by step as I am a new to script
I prefer using PS or command line like DSquery Etc…
Or if there is  other sample way to do it in Active Directory

Thank you in advance
  • 4
  • 4
1 Solution
Import-CSV FileName.csv | ForEach {Add-DistributionGroupMember -Identity "GROUP-NAME" -Member $_.Name}

Open in new window

having each name on a line in the csv file
RabihhajAuthor Commented:
Hi Brendanmeyer,

Do You mean in PS or Command line

How about the name , Is that First name and last name  in the CSV file is any ; or , at the ends of each line

Could you please send me some example or link
I approciate you comment and help
this is in powershell

do you have the users usernames or full names?

if usernames
create a txt file with each username on a line (save it as FileName.csv) in the directory that your powershell it running at

in the command above change GROUP-NAME to the actual name of the group tou are trying to add the users to


from powershell
Import-CSV FileName.csv | ForEach {Add-DistributionGroupMember -Identity "execs" -Member $_.Name}
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

RabihhajAuthor Commented:
Hi  brendanmeyer,

What i found out on the server , MS office not Install on the server , is any other way to create the file with TXT file instead CSV.

I look at the import-??? can not find TXT command for it in PS .

Please help
well yeah

just create a text file with the names on each line.
and then just rename from
names.txt to names.csv
RabihhajAuthor Commented:
Hi ,
thank you for your quick response. I will try this tomorrow and let you know ...

that only part I am not sure is where do i save the file and how do i find out  where is my PS is running.

"(save it as FileName.csv) in the directory that your powershell it running at
i tried this at my home PC , is this the correct path, where i should save the file and run the scripts


RabihhajAuthor Commented:
Hi  brendanmeyer,

I tried the above and it worked , now if i only have an email address can i add them to the DL by inport Email address instead Name.

Do  i have to  change any things in the scripts

it should work fine
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now