Add bulk users to Distribution Group using Powershell Cmdlet

Anthony K O365
Anthony K O365 used Ask the Experts™
on
I need to add about 100 users to a distribution group in my Exchange 2010 organization. The users are in a csv file. What is the power shell command to use to import these users?

Thanks!!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
import-csv c:\users.csv | foreach-object { add-distributiongroupmember <group> -member $_.name }

where name is the column header
Anthony K O365Messaging Consulting

Author

Commented:
I'm not sure of the columns in my csv file. Would you happen to know the column fields to provide for my csv?
post the header row and i can tell you what to use
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Anthony K O365Messaging Consulting

Author

Commented:
emailaddress  firstname  lastname displayname
import-csv c:\users.csv | foreach-object { add-distributiongroupmember <group> -member $_.emailaddress }

or

import-csv c:\users.csv | foreach-object { add-distributiongroupmember <group> -member $_.displayname }

Anthony K O365Messaging Consulting

Author

Commented:
Since I'm dealing specifically with Dynamic Distribution Groups, the problem I'm having is the cmdlet is not accepting add-dynamicdistributiongroupMember. Should I not able to substitute this command?
you do not add members to a dynamic distribution group, you create a filter and the membership dynamically changes based on that filter
Anthony K O365Messaging Consulting

Author

Commented:
He was absolutely correct. I need to modify the filter

thanks

Commented:
hello,
any chance to import users from file to distribution group from csv using column number, because my csv file doesnt have headers?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial