Solved

Adding users to group from text file sideways Exchange 2010 powershell question

Posted on 2014-01-03
1
378 Views
Last Modified: 2014-01-09
Hello guys I have a quick question about powershell. I have an input file and the it is a bit differentthan what I am use to working with. The following is displayed this way.

groups                            users
Group                   user,user5, user9, user user03, user32, user83,user84
group2                  anotheruser,  anotheruser1,  anotheruser93,anotheruser893
0
Comment
Question by:techdrive
1 Comment
 
LVL 53

Accepted Solution

by:
Will Szymkowski earned 500 total points
ID: 39754078
Might be a little easier to use a CSV file. I have created 2 scripts below as I am not sure if you are talking about AD Groups (security) or Distribution Groups. 1st script is for Distribution Groups, 2nd is for AD Security.

Construct your CSV file like below (same CSV file for both scripts)
Groups  Users
Group1  user1
Group1  user2
Group1  user3
Group2  user9
Group2  user7

Distribution Group Bulk Add
Add-PSSnapin Microsoft.Exchange.Management.Powershell.E2010
$GroupList = Import-Csv "c:\mycsv.csv"
foreach ($Group in $GroupList) {
$Group.Groups
$Group.Users
Add-DistributionGroupMember -Identity $Group.Groups -Member $Group.Users
}

Open in new window


Security Group Bulk Add
Import-Module activedirectory
$GroupList = Import-Csv "c:\mycsv.csv"
foreach ($Group in $GroupList) {
$Group.Groups
$Group.Users
Add-ADGroupMember -Identity $Group.Groups -Members $Group.Users
}

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
In this video we show how to create an Accepted Domain 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 Mail Flow >> Ac…

763 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