how to list members of the group using gam

15,271 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 AM4/16/24
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 PM4/16/24
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 PM4/16/24
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 PM4/16/24
to google-ap...@googlegroups.com

Shubham Pawar

unread,
Apr 17, 2024, 12:56:43 AM4/17/24
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 AM4/18/24
    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


    laurent

    unread,
    May 23, 2024, 6:07:48 PM5/23/24
    to GAM for Google Workspace
    so there is no technical way to list or remove an external group (given a user having an unwanted external group)?

    Adam Johnson

    unread,
    May 24, 2024, 10:01:03 PM5/24/24
    to google-ap...@googlegroups.com
    Laurent,

    You would not expect to have admin rights in another organization's Google domain, would you?  That's what it would take to list members of groups belonging to another domain.  For that matter, users in your domain could be added to email lists in non-google systems, for which Google's servers would not even store the membership information.

    That being said, if it IS a google group, the user may be able to look at the details of a message they receive from such a group to see which group name it was sent from, and should have an unsubscribe option.

    You received this message because you are subscribed to a topic in the Google Groups "GAM for Google Workspace" group.
    To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-manager/mtYrDUo0Gag/unsubscribe.
    To unsubscribe from this group and all its topics, 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/65411178-c71a-47fd-a485-3e7906c0bde6n%40googlegroups.com.

    Roman Gordienko

    unread,
    Nov 20, 2024, 5:12:42 AM11/20/24
    to GAM for Google Workspace
    Hi, the first thing I wanted to say is: "thanks for such a cool tool as GAM ADV". Second - I had a question, can I some how get a list of users who are granted access to GAM (GAM-API) through the execution of a command gam?
    I use a command - gam user us...@domain.com check serviceaccount only for checking each individual user, if it outputs FALSE - not provided, if TRUE - provided. But how to see all users because the output alone is too long to test FALSE or TRUE?

    Is this not what I need? The question of "security" simply arose when we worked with GAM: then we go to Google Cloud Credentials, to Domain Wide Delegation, and so on. But when we set which user to "start working" from at the stage of the script, when he asks: "Are you ready to authorize GAM to manage Google Workspace user data and settings? (yes or no) yes", we do not grant this user access to GAM? Maybe I didn't ask the question correctly, but I highlighted the important thing at the beginning.

    Thank for your future reply

    Ross Scroggs

    unread,
    Nov 20, 2024, 10:28:25 AM11/20/24
    to google-ap...@googlegroups.com
    The following command checks to see if service account access is enabled; us...@domain.com is any valid email address in the domain.
    If you use your super admin email address you will avoid incorrect FALSE results that might occur if the regular us...@domain.com 
    is in a OU that disables Gmail/Drive/...

    gam user us...@domain.com check serviceaccount - checks to see if service account access is enabled.

    Service account access does not grant users access to GAM, it grants GAM access to the users Drive/Gmail/Calendar data.

    Ross
    ----
    Ross Scroggs


    Roman Gordienko

    unread,
    Nov 22, 2024, 4:21:19 AM11/22/24
    to GAM for Google Workspace
    Thank you for the response! I understand how to check if GAM has access to a user's data. However, what I'm trying to determine is who can use GAM commands to manage Google Workspace (e.g., admins or specific users). Is there a way to get a list of users who have this access?
    Or, if I misunderstood the access structure, can you clarify how GAM access is controlled?

    --

    Best regards,

    Roman Gordienko
    DevOps Engineer

    Itera Research | www.itera-research.com

    Ross Scroggs

    unread,
    Nov 22, 2024, 9:14:58 AM11/22/24
    to google-ap...@googlegroups.com
    GAM is a progrm installed on a computer, users with allowed access to the computer have access to GAM.

    Ross
    ----
    Ross Scroggs


    Adam Johnson

    unread,
    Nov 23, 2024, 11:13:58 AM11/23/24
    to google-ap...@googlegroups.com
    Since GAM is an awesome convenient wrapper around Google API calls, I suspect the real question is:
    Can Gam query for users who have API access permissions?  Or maybe just the admin level API permissions ?

    You received this message because you are subscribed to a topic in the Google Groups "GAM for Google Workspace" group.
    To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-manager/mtYrDUo0Gag/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to google-apps-man...@googlegroups.com.
    To view this discussion visit https://groups.google.com/d/msgid/google-apps-manager/6C48F7CF-319C-44E6-8BB0-E90C28D757C2%40gmail.com.

    Ross Scroggs

    unread,
    Nov 23, 2024, 11:41:48 AM11/23/24
    to google-ap...@googlegroups.com
    Reply all
    Reply to author
    Forward
    0 new messages