GAM commands in batch not working

634 views
Skip to first unread message

Jeff Sararas

unread,
Mar 9, 2021, 11:07:17 PM3/9/21
to GAM for Google Workspace
I think I'm not understanding the correct syntax in the wiki for batching GAM commands.

I have setup the groups already to allow external members. Before attempting to batch, I ran:

gam update grou...@domain.com add member users "ema...@external.com,ema...@external.com" which works perfectly. Results appear as

Group:  grou...@domain.com, Will add 2 MEMBERs.
Using 2 processes...
 Group:  grou...@domain.com ,  ema...@external.com,  Added as MEMBER
 Group:  grou...@domain.com ,  ema...@external.com   Added as MEMBER

The 2 members appear in my group as expected. 

But when I try and batch these command in a .txt file, they have no effect.

I made members.txt consisting of:


I then ran

gam batch members.txt

The results I see are:

Group:  grou...@domain.com, Will add 2 MEMBERs.
Group:  group...@domain.com, Will add 2 MEMBERs.
Group: group...@domain.com, Will add 2 MEMBERs.

But it seems to be an empty promise - no members get added to the groups.

I tried putting commit-batch between each line but no dice.

Do I have it wrong? Do I have to delimit each command? Or can you not batch these particular commands together?




Brian Kim

unread,
Mar 10, 2021, 8:13:06 AM3/10/21
to GAM for Google Workspace

Ross Scroggs

unread,
Mar 10, 2021, 9:41:43 AM3/10/21
to google-ap...@googlegroups.com
Jeff,

You're using Standard GAM and because of the way it is coded you can not add/delete more that one user to/from a group from within a batch command.
Basic gam does not have the tbatch command as Brian suggested.

What you can do with your version is the following.
Make a CSV file GroupAdds.csv with two columns: group,user
gam csv GroupAdds.csv gam update group "~group" add member "~user"

--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/ed406491-bf1b-42a5-a6c3-8abac3382a8an%40googlegroups.com.

Jeff

unread,
Mar 10, 2021, 12:25:39 PM3/10/21
to GAM for Google Workspace
Thanks very much for the suggestions and explanations. To clarify:

Am I still limited to a single ~user against each ~group in the CSV? I'm more than happy to iterate through my member lists (for the 2nd member, 3rd member etc), but wanted to ask before doing that work.

Or can I have group,user1,user,2user,3,user4, (where some would be blank).

The Part 2 of what I am hoping to do is a second batch of owners who don't receive emails:

gam update grou...@domain.com add owner nomail users "ema...@external.com, ema...@external.ca", which again works as a single statement. Can I CSV this too? Apologies, I couldn't find how to set as  owner and specify nomail as variables in the CSV.
Reply all
Reply to author
Forward
0 new messages