Import file to change group membership

Say, you get a list of groups and users which need to be in them, how do you quickly add the users to the groups?

For example, Andriy had to import group membership from files like:
Orgname Username
OP-420-HO-S-00 net1111
RB-430-AD-A-12 net2222
AC-200-RL-B-10 net1234

In which Orgname is indeed the name of the group.

In such cases, Import-CSV and Add-QADGroupMember are your friends. Just don’t forget to properly specif the column numbers and the delimiter used in the files you get:

Import-Csv C:\list.csv -Delimiter ' ' | 
 ForEach-Object {
  Add-QADGroupMember -Identity $_.Orgname -Member $_.Username 
 }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




My Recent Tweets

Legal

The posts on this blog are provided “as is” with no warranties and confer no rights. The opinions expressed on this site are mine and mine alone, and do not necessarily represent those of my employer - WSO2 or anyone else for that matter. All trademarks acknowledged.

© 2007-2014 Dmitry Sotnikov

April 2010
M T W T F S S
« Mar   May »
 1234
567891011
12131415161718
19202122232425
2627282930  

%d bloggers like this: