A list of groups tells you names. A membership export tells you who can reach what. It is the first thing to pull before a cleanup, an audit, or a new technology director's first week, and the thing you will wish you had pulled before any group was deleted.
The short answer
gam print group-members
That prints one row per membership, across every group in the domain. To send it to a Google Sheet instead of the screen:
gam print group-members todrive
Groups inside groups
A group can be a member of another group, and by default the export leaves it that way. The GAM documentation: "By default, members that are groups are displayed as a single entry of type GROUP". (GAM wiki: Groups Membership) To expand those rows into the people inside them:
gam print group-members recursive noduplicates
The recursive option, in the documentation's words, "recursively expands group members to display their user members."
Which one to keep
Keep both, because they answer different questions.
The plain export records the direct membership structure: which groups contain which other groups. The expanded export throws that nesting away, so it cannot give the shape back to you. Rebuilding a deleted group takes more than its members, though. Its settings, aliases and posting permissions go with it, which is why the cleanup guide starts with a fuller export than this one.
The recursive export records the people: everyone who actually receives a group's mail and inherits what was shared to it. That is the one to read when the question is "who can see this folder?"
Just the owners
To see who owns each group, filter by role:
gam print group-members roles owner
Groups with no owner at all will not appear in that list, which makes it a quick way to spot the ones nobody is responsible for: compare it against your full list of groups.
Sources
- GAM wiki: Groups Membership — GAM7 documentation.
print group-members, and itsrecursive,noduplicates,rolesandtodriveoptions.
Related guides
- How to clean up years of old Google Groups
- How to find every Google Group a user belongs to with GAM
- How to remove a user from all Google Groups with GAM
In ORINEX Workspace, the Groups page exports every group with its member count in one click, and each group's own page lists its members. What ORINEX Workspace does.