Add user to multiple groups

4,800 views
Skip to first unread message

Ryan Bahten

unread,
Jul 31, 2014, 1:40:26 PM7/31/14
to google-ap...@googlegroups.com
I would like to add some newly created users to multiple groups (up to 5 in some cases) with one command. Anyone have any suggestions? I'm running 3.21 on 10.9.4. I'm OK with doing it one user at a time, but it would be nice to be able to add that one user to multiple groups with one bulk command. Thanks in advance for any help,
-Ryan

Karl Hehr

unread,
Jul 31, 2014, 1:43:13 PM7/31/14
to google-ap...@googlegroups.com
gam update group $yourgrouphere user $usernamefromcsv


repeat for each group. If you create a csv with the group names and the member names ahead of time you can read them into a command as variables


On Thu, Jul 31, 2014 at 12:40 PM, Ryan Bahten <rba...@delnorte.k12.ca.us> wrote:
I would like to add some newly created users to multiple groups (up to 5 in some cases) with one command. Anyone have any suggestions? I'm running 3.21 on 10.9.4. I'm OK with doing it one user at a time, but it would be nice to be able to add that one user to multiple groups with one bulk command. Thanks in advance for any help,
-Ryan

--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/86b29265-b15a-4327-bd6f-071b88dfb240%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Karl H. Hehr
Technology Director
Ames Community Schools
---------------------------
twitter: karlhehr
skype: karlhehr

Bruce Selzler

unread,
Apr 10, 2015, 10:30:34 AM4/10/15
to google-ap...@googlegroups.com
Hello team,

Im having trouble with this as well.  Im using the following command:

gam update group "sms-6thgradestudents" add file 'sms6th.txt'


And it tries to work, however it generates the following error:

 adding member se**_a*******@sesd.org...Error 403: Insufficient Permission - insufficientPermissions


(The asterisks are mine) Any ideas whats causing this?

Let me know what you think.

- Sez


On Thursday, July 31, 2014 at 10:43:13 AM UTC-7, Karl Hehr wrote:
gam update group $yourgrouphere user $usernamefromcsv


repeat for each group. If you create a csv with the group names and the member names ahead of time you can read them into a command as variables
On Thu, Jul 31, 2014 at 12:40 PM, Ryan Bahten <rba...@delnorte.k12.ca.us> wrote:
I would like to add some newly created users to multiple groups (up to 5 in some cases) with one command. Anyone have any suggestions? I'm running 3.21 on 10.9.4. I'm OK with doing it one user at a time, but it would be nice to be able to add that one user to multiple groups with one bulk command. Thanks in advance for any help,
-Ryan

--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.

Duke Le

unread,
Aug 20, 2015, 5:01:22 PM8/20/15
to Google Apps Manager
Yes, I desperately need to figure out how to add a user to multiple groups either command or script. I've look far and wide to no avail.  Any help would be great!

Kevin Melillo

unread,
Aug 20, 2015, 7:02:16 PM8/20/15
to Google Apps Manager
Good evening...  I found this elsewhere on the forums...  I believe it should work for the Mac.  Please try it out, and let me know your results.


while IFS=, read username; do python gam.py delete user $username; done < deleteusers.csv


I have modified the above code with the command you are looking to run.  I have not tested this, because I do not have a Mac.  


white IFS=, read groupname; do python gam.py update group $groupname add member user <email address>; done < groupnames.csv


The contents of the CSV file should be each groups email address followed by a comma.

Duke Le

unread,
Aug 20, 2015, 7:59:20 PM8/20/15
to Google Apps Manager
I get this error on a MAC: -bash: syntax error near unexpected token `done'

Jay Lee

unread,
Aug 20, 2015, 8:08:09 PM8/20/15
to google-ap...@googlegroups.com

Assuming groups.csv is a file with all your groups and groupname as the first line, try:

gam csv groups.csv gam update group ~groupname add member us...@example.com

Jay

To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.



--
Karl H. Hehr
Technology Director
Ames Community Schools
---------------------------
twitter: karlhehr
skype: karlhehr

--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.

To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-apps-manager.

Duke Le

unread,
Aug 20, 2015, 8:19:02 PM8/20/15
to Google Apps Manager
Hi Jay,

The command provides this but does not add the user to the multiple groups: starting 5 worker threads...

Any further assistance is greatly appreciated. 

Duke
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.



--
Karl H. Hehr
Technology Director
Ames Community Schools
---------------------------
twitter: karlhehr
skype: karlhehr

--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.

Duke Le

unread,
Aug 20, 2015, 8:24:50 PM8/20/15
to Google Apps Manager
Thanks, everyone! With Jay's direction. I tinkered with it and here's what did work:


gam csv groups.csv gam update group ~groupname add member us...@example.com

  • There must be a header in the called "groupname"
  • each group name must on it's own line

THANK YOU EVERYONE! One day totally worth the effort.

Duke Le

unread,
Aug 20, 2015, 8:32:24 PM8/20/15
to Google Apps Manager
Each group name must on it's own line or separated by a comma in the groups.csv file.

Will C

unread,
Feb 3, 2016, 9:07:29 AM2/3/16
to Google Apps Manager
Hi All,

This is great - very useful!!

I'm wondering if it is possible to use the group email address instead of the groupname though.  This makes it easy to copy a list of groups that user belongs to via Admin Cpanel and apply them to a new user..

If the "groups.csv" file contains e.g. groupemail, gro...@domain.com, gro...@domain.com etc..
and the command looked like:
gam csv groups.csv update group ~groupemail add member joh...@domain.com

that would be awesome..... or is this already possible..?

Many thanks!!!!
W

Will C

unread,
Feb 3, 2016, 9:39:40 AM2/3/16
to Google Apps Manager
DOH!
I'm was being stupid... Sorry!
of course it works using the email address.

Well, let me at least take the opportunity to say thanks again for such a wonderful tool!!!

All the best,
W

Raj SINGH

unread,
May 13, 2020, 3:55:51 AM5/13/20
to GAM for G Suite
Hi 
Can somebody help me to do following
I have a group of teachers, group of children's and courses list
Can i do something like adding all students, and teachers to list of course with one .csv files if i create
Reply all
Reply to author
Forward
0 new messages