how to list members of the group using gam

10,714 views
Skip to first unread message

Yida Zhang

unread,
Jul 12, 2018, 1:26:40 AM7/12/18
to GAM for G Suite
Hi 

how to list members of the group using gam

thanks

Ross Scroggs

unread,
Jul 12, 2018, 8:19:13 AM7/12/18
to google-ap...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" 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 https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/dff4fb61-e795-44e2-92e4-7e107cec7a8d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Avrohom Eliezer Friedman

unread,
Jul 12, 2018, 9:02:04 AM7/12/18
to google-ap...@googlegroups.com
I've been doing 

gam whatis gr...@domain.com

Also gives you the members - but in a diff format with diff info. One of the reasons I like it is that the command is short, gives the number of ppl in the group and it's the same command when I want to look up info on a user "gam whatis user@domain"


-----
Avrohom Eliezer Friedman
IT Director

Yeshiva Toras Chaim Toras Emes
305-944-5344 x222 (o)
305-494-2055 (cell)
aefri...@ytcteam.org


Peter Smulders

unread,
Jul 13, 2018, 10:04:17 AM7/13/18
to GAM for G Suite
@Avrohom: 


gam whatis gr...@domain.com

Also gives you the members - but in a diff format with diff info. One of the reasons I like it is that the command is short, gives the number of ppl in the group and it's the same command when I want to look up info on a user "gam whatis user@domain"


This is a bad idea in general. Although it works, it may change in the future; the 'whatis' command is meant only to tell you what a particular item is (group, alias, user, etc). You can not rely on the 'bonus' information being provided. Instead, you are better off learning the proper use of the proper commands:

$ gam info user some...@yourdomain.com
$ gam info group some....@yourdomain.com

--peter

Adam Johnson

unread,
Jul 1, 2022, 6:36:06 PM7/1/22
to GAM for Google Workspace
I know it's an old thread, but it came up in my search, so maybe others are still referring to it. I've been using:

gam print group-members group <EmailAddressOfGroup> fields "role type delivery status useremail"

I found I had to enclose the list of fields I wanted in quotes, since "role" is also a keyword for the "print group-members" command - it would let you print out only members, or only managers, or only owners.

I did find that the useremail field might be an alias rather than a user's primary email if they were added to the group when that alias was their primary address.

Also, deleted users can show up in group membership lists - if you're printing out the Status field, it will be blank for deleted users (as well as external-to-your-domain(s) users)

The fields I was including are
Role:  OWNER, MANAGER, MEMBER
Type: USER, GROUP
Status: <blank>, ACTIVE, SUSPENCDED, ARCHIVED
Delivery (shows up in csv as delivery_settings) - ALL_MAIL, NONE, DISABLED, DAILY, DIGEST

Ross Scroggs

unread,
Jul 1, 2022, 6:46:34 PM7/1/22
to google-ap...@googlegroups.com
Adam,

You can use a comma separated list rather than s space separated list.
gam print group-members group <EmailAddressOfGroup> fields role,type,delivery,status,useremail

Ross

--
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.


--

Michael J McNally

unread,
Feb 15, 2023, 11:55:42 AM2/15/23
to GAM for Google Workspace
Running the exact command given above, I get "ERROR: 400: Invalid field selection delivery - invalidParameter".
Documentation on the wiki states  fields <list,of,fields>. Is there a way to get a list of what the currently valid fields are?

Current goal is to export all group members including role and subscription settings.

Thanks.

Arnaud Lienard

unread,
Mar 24, 2023, 5:50:52 AM3/24/23
to GAM for Google Workspace
Hi all,

I'm asked to list the members of a group but this group contains only groups, the users are in these subgroups.

Example : Gr...@domain.com contains Grou...@domain.com, Grou...@domain.com, Group-M...@domain.com

When I run the command "gam print group-members group Gr...@domain.com", it only shows me the name of the groups contained in Gr...@domain.com and not the name of the people contained in these 3 sub-groups.

Is there a command to list the users who are in the group and the subgroups?

Thank you
Arnaud

Ross Scroggs

unread,
Mar 24, 2023, 8:41:55 AM3/24/23
to google-ap...@googlegroups.com
Arnaud,

Standard or Advanced


]gam print group-members group Gr...@domain.com recursive

Ross
----
Ross Scroggs



Please consider the environment before printing this e-mail.

Information in this message is confidential and is intended solely for the persons to whom it is addressed. If you are not the intended recipient please notify the sender and immediately delete this message from your computer.

This system may be monitored or recorded to secure the effective operation of the system and for other lawful purposes.  Please check out the Privacy Notice on our website for details.

--
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.

Arnaud Lienard

unread,
Mar 24, 2023, 9:05:01 AM3/24/23
to GAM for Google Workspace
Hi Ross,

Thank you, this command line is perfect :-)

Arnaud

EDWARD ARAGON

unread,
Aug 14, 2023, 5:06:53 PM8/14/23
to GAM for Google Workspace
Greetings,  Is there a command to just show the managers or owners of the group?  Thank you in advance

Ross Scroggs

unread,
Aug 14, 2023, 5:52:44 PM8/14/23
to google-ap...@googlegroups.com

--
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.


--

EDWARD ARAGON

unread,
Aug 15, 2023, 5:15:28 PM8/15/23
to GAM for Google Workspace
Thank you so much! You saved me valuable time. These are student email groups consisting of hundreds of members & school admins were the managers or message moderators, and they needed updating coz the school admins have changed.

Shubham Pawar

unread,
Apr 16, 2024, 8:51:15 AM (3 days ago) Apr 16
to GAM for Google Workspace
Is there any command to list group(internal or external) where the user has subscribed or added, Was trying below command but no luck


gam print groups query memberkey='<user email address inc @Domain>' todrive 

Ross Scroggs

unread,
Apr 16, 2024, 12:16:24 PM (3 days ago) Apr 16
to google-ap...@googlegroups.com
I'm not clear on the question, send me a Meet/Zoom invitation.

Ross
----
Ross Scroggs


Maj Marshall Giguere

unread,
Apr 16, 2024, 12:27:36 PM (3 days ago) Apr 16
to google-ap...@googlegroups.com
If you are trying to find just the groups a user is subscribed to:

> gam print users select <us...@example.com> groups todrive

Ross Scroggs

unread,
Apr 16, 2024, 12:30:21 PM (3 days ago) Apr 16
to google-ap...@googlegroups.com

Shubham Pawar

unread,
Apr 17, 2024, 12:56:43 AM (3 days ago) Apr 17
to google-ap...@googlegroups.com
Hi Ross,

So basically I have tried the below command to get group list both internal and external, but I am getting only internal group details. I am looking for group list where user is added both internal and external groups

    1.  gam print groups query memberkey='<user email address inc @Domain>' todrive
    1. gam user shu...@dev.searce.me show groups

    Ross Scroggs

    unread,
    Apr 18, 2024, 11:18:12 AM (yesterday) Apr 18
    to google-ap...@googlegroups.com
    The Directory API (https://developers.google.com/admin-sdk/directory/reference/rest/v1/groups/list) only deals with groups in your domain, it knows nothing of users in external domain groups.

    Ross
    ----
    Ross Scroggs


    Reply all
    Reply to author
    Forward
    0 new messages