Running list of useful GAM commands

If you admin Google Workspaces and don’t GAM, you should GAM – get it from here. The big command reference list is here, but these are the specific ones I use most often.

Giving access to a mailbox
gam user user1@domain.com delegate to user2@domain.com

Checking / updating send as addresses
gam user user1@domain.com sendas user2@domain.com "Friendly Name" gam user user1@domain.com show sendas

See a user’s calendars
gam user user1@domain.com show calendars

Check permissions for a calendar
gam calendar user1@domain.com showacl
gam calendar calendaremail@group.calendar.google.com showacl

Sharing a calendar
gam calendar user1@domain.com add editor user2@domain.com
gam calendar calendaremail@group.calendar.google.com add editor

Forwarding email (need to do both commands)
gam user user1@domain.com add forwardingaddress user2@domain.com
gam user user1@domain.com forward on user2@domain.com <delete | keep>

Find out who owns a file based on Google file ID (replace FILE_ID – Requires GAM7)
gam config auto_batch_min 1 multiprocessexit rc=0 redirect csv .\file_owner_lookup.csv multiprocess redirect stderr null multiprocess all users print filelist select id FILE_ID fields id,name,owners.emailaddress norecursion showownedby any

Give a user permissions / ownership of a file based on Google file ID – you need to know the account of a user with permission to do that
gam user userthathasaccess@domain.com add drivefileacl <fileID> user userthatneedsaccess@domain.com role <owner | editor>

Check a user’s vacation / out of office status and message
gam user user@domain.com show vacation

Set a user’s vacation / out of office status and message
gam user user@domain.com vacation on subject "The reply subject" message "The reply message"

Export all groups and members to a CSV
This creates a row in the csv for each group, all members in one cell
gam print groups name members owners managers > the_name_of_the_output_file.csv
This creates a row in the csv for each member
gam print group-members > the_name_of_the_output_file.csv

Set ALL existing groups to only allow Members to view conversations, only allow invited folks to join, and only allow members to view member list
gam print groups fields email > groups.csv
gam csv groups.csv gam update group "~email" whocanviewgroup ALL_MEMBERS_CAN_VIEW
gam csv groups.csv gam update group "~email" whocanjoin INVITED_CAN_JOIN
gam csv groups.csv gam update group "~email" whocanviewmembership ALL_MEMBERS_CAN_VIEW

Create a new folder on a user’s My Drive
gam all users add drivefile drivefilename "

Give someone access a folder on a user’s Drive
gam user <owner@email.com> add drivefileacl user <guest@email.com> role writer

Add an address to a user’s contacts. Handy for creating exceptions for the built-in username spoofing protection.
gam user <my_user@domain.com> create contact email personal <contact@domain.com> primary
gam all users create contact email personal <contact@domain.com> primary