Solved

powershell add multiple users to multiple groups

Posted on 2013-11-19
2
1,747 Views
Last Modified: 2014-03-13
Good morning I have a huge issue. I am trying to add multiple users to multiple groups with an input file. I have searched for this on the net and mostly I see where you have to indicate each group and then you can go through your input file. I would like to know how can this be done with multiple groups and users in an input file. For example below.


DLNAME    member
dldistro1    usersomeone
dldistr01    usersomeone2
dldistr02    something
dldistro02 somethingagain
dldistro03  jane.doe
dldistro04  john.doe

I was using this as my code

import-csv c:\temp\dlmembers.csv | foreach {add-distributiongroupmember -identity "groupnane" -member $_.Member }
0
Comment
Question by:techdrive
2 Comments
 
LVL 35

Accepted Solution

by:
Joseph Daly earned 500 total points
ID: 39659493
You code looks like it should work what happens when you run it. Only change I made was to change the identity to use the CSV file heading.

import-csv c:\temp\dlmembers.csv | foreach {add-distributiongroupmember -identity $_.DLNAME -member $_.Member }
0
 

Author Comment

by:techdrive
ID: 39659511
THATS WHAT it was thanks
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

We are happy to announce a brand new addition to our line of acclaimed email signature management products – CodeTwo Email Signatures for Office 365.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
how to add IIS SMTP to handle application/Scanner relays into office 365.

762 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now