The Ultimate Manual to Google Apps Manager Commands
Administrators using Google Workspace know that management of the account can become unwieldy over time. One of the best ways to manage Workspace is using Google Apps Manager commands, also known as GAM commands.
Using GAM commands does require a bit of know-how, but it delivers helpful results.
What Are Google Apps Manager Commands Anyway?
Through Google Apps Manager, those working with Google Workspace can issue commands that act as shortcuts. Administrators can do things like use GAM commands to create and manage their Workspace users and groups.
The administrator can issue these commands to make changes to a large number of users at once. It helps with the automation of administrative work in Workspace and with running bulk operations.
The Google Apps Manager is a free, open-source tool. Anyone can download and use it. To use it to issue commands to a Workspace account, users must have a paid account with Workspace outside of the free trial period.
Google does not provide customer support for GAM. Those wanting to learn more about GAM or touch base with other users will need to visit and make connections through message boards or other social media tools.
Running GAM Commands Locally
When most people think of apps, such as the Google apps found in Workspace, they focus on the cloud. With Google Apps Manager, however, the user will download the tool to the local network. This is not a web-based tool.
GAM runs from a command-line interface. Modern programmers and app developers will often use a command-line interface, but very few other people do these days.
The command-line interface differs quite a bit from Windows and mobile interfaces. But most people can gain a good feel for using it relatively quickly, even if they aren’t overly familiar with programming.
How Google Apps Manager Commands Work
Those using Google Workspace do not have to make use of GAM commands. It’s simply a tool designed to ease the process of managing a group of users or individual users in Workspace.
GAM makes use of Google’s Application Programming Interface (API). The Google API is an interface for Google Cloud Platform services. Through Google APIs, the various Google services can communicate with each other and with other services.
Some of the basic functions a system administrator for Google Workspace can run through GAM commands include:
- Creating groups or units
- Creating users
- Deleting groups or units
- Deleting users
- Editing user information
- Managing calendars
- Managing files
- Managing users
- Managing groups or units
- Monitoring activity in Workspace
- Restoring users
- Restoring groups or units
- Suspending users
- Suspending groups or units
- Updating user information
Using GAM Versus Google Admin Console
Many administrator functions through the Google Admin Console are available through Google Apps Manager commands. However, once the administrator learns the basics of using GAM commands, accomplishing these functions should take less time through GAM.
For more detailed information on Google Apps Manager commands you can run, you can find a host of cheat sheets and other resources on the internet. Because this is open-source software, the user base provides all of these resources, which are free to use.
Here are some specific examples of tasks you could accomplish in Workspace when using GAM commands.
Example 1: Creating a Google Sheets File With Workspace Data
One of the handiest commands you can run using Google Apps Manager commands is copying data from Workspace into a Google Sheets file. You then can create a .csv file from this Google Sheets data, which makes the data easier to work with when using GAM commands. Some GAM commands even require the use of a .csv file.
For example, you may want to use GAM commands to create a Google Sheets file containing user names for everyone in the organization who uses Workspace. You then can use that information with other Google Apps Manager commands to take further actions on the data.
To issue this GAM command, at the command prompt, type:
gam print users todrive
This command allows the new Google Sheets file to pull the data from Workspace. You can then access this file from Google Drive.
Example 2: Changing the Organization’s Domain Name
When an organization needs to change its domain name for rebranding or because someone else acquired the organization, every user’s email address based on the old domain name will need to change. This necessitates making changes to Google Workspace user names.
Performing these changes manually through the Google Admin Console would take a long time. A more efficient option is to issue GAM commands to change all user names at one time.
To perform the bulk action on user names, start by creating a .csv file containing all of the user names from Workspace that need changing. Then issue a GAM command that tells the software to replace the old domain name in the .csv file with the new domain name. The GAM command looks like the following:
gam csv CSV FILENAME gam update user CURRENT USERNAMES username NEW USERNAMES
Substitute your specific data in the areas of the formula with the capitalized, italicized text.
After running the Google Apps Manager command, copy the data containing the new domain name from the .csv file and return it to Workspace.
Example 3: Adding Members to a New Group
Within Workspace, you may have a series of groups of users. This is a helpful way to organize users, making it easier to give the group members certain types of functions and permissions. Rather than assigning permissions person by person, the administrator can assign the same permissions to everyone in the group, saving time.
As another time-saving measure with GAM, the administrator can add all members from one group into another group. This action will give the members of the first group all of the functionality and permissions found in the second group. Using GAM commands greatly simplifies this action.
To perform this function, use the following GAM command:
gam update group NEW GROUP NAME add member ou FIRST GROUP NAME
Add in the specific data for your Workspace network in place of the italicized and capitalized text. The “ou” in this Google Apps Manager command is short for “organizational unit.” If either group in this GAM command is a subgroup, the command line will need to include backslashes to indicate the subgroup status.
Example 4: Setting an Organization-Wide Signature for Emails
Having all Workspace emails in the organization carry the same signature can be an excellent branding opportunity. It can contain links to the company’s website or social media pages. It can also include the company’s slogan or logo. Consistency is essential in branding, and an organization-wide email signature can help with that.
The same signature on every email can give clients and customers confidence that the email is not from a fake account trying to duplicate your organization. The custom signature indicates the email is genuine.
As an administrator, you can create a .txt file that contains the signature text and graphics you want to use for the company-wide signature. To add this signature company-wide, use the following GAM command:
gam all users signature file FILENAME
Substitute the actual filename and path containing the .txt file in place of the capitalized and italicized text in the command string.
Example 5: Deleting a Single User
Removing someone who left the organization from the Workspace user list is a quick and easy process with GAM commands. This GAM command can delete the user and all of their email aliases included in Workspace. Use the following GAM command to delete a user and all email aliases:
gam user EMAIL ADDRESS delete aliases
Substitute the user’s email address in Workspace for the italicized, capitalized text in the command string.
To only delete a single user based on the email address while ignoring aliases, use the following GAM command:
gam delete user EMAIL ADDRESS
Example 6: Updating a User’s Email Address
Each user on the team will have a primary email address in use in Workspace. Should the administrator need to change this primary address to another address, this is an easy process to handle by using the following GAM command:
gam update user CURRENT PRIMARY EMAIL email NEW PRIMARY EMAIL
Add the proper email addresses in place of the italicized and capitalized text in the command string. Workspace will keep the current primary email address as an alias email for the user.
Adding a second email address, such as a home address, to the Google Workspace user’s primary email address is possible with GAM commands, too. Use the following command string:
gam update user CURRENT PRIMARY EMAIL otheremail home HOME EMAIL
Example 7: Finding Last Login Time for Users
It sometimes may be helpful to create a list of the most recent login times for all of the Workspace users in the organization. Administrators may want to see whether team members are actually doing the work expected of them.
Or, should the network have a data breach, determining the last login time for each user can help track down the breach and the responsible party.
To see a list of the last login times for all of the users on the network, use the following command string using Google Apps Manager:
gam info users DOMAIN EMAIL query fields lastlogintime
How to Get Started With Google Apps Manager Commands
Continue reading for a basic description of how to install and begin using Google Apps Manager.
Step 1: Understanding the GAM Prerequisites
To download and set up Google Apps Manager, you will need to have domain administrative privileges. When running and using GAM commands after installation, users do not need this same level of administrative privileges.
To run GAM commands, you will need to use a computer running the Windows, Macintosh, or Linux operating systems. This functionality will not work on a mobile device running iOS. Users on an Android or Chrome OS device may be able to use GAM commands in an extremely limited way. However, the best option requires a computer and one of the three major operating systems.
If you can access Google Admin Console in your Workspace account, you should have the privileges required to download, install, and set up Google Apps Manager.
Step 2: Downloading the GAM Software
Because Google does not offer customer support for Google Apps Manager, you’ll be downloading the software from a non-Google site. It is open-source software, meaning the programming community as a whole maintains and issues updates for GAM.
Visit GitHub to download the GAM software. The latest version of the GAM software should be at the top of the page of the GitHub download website. You can scroll lower on the page to find older versions.
Look through the list of files to find the version of the GAM software that matches your computer’s operating system. The file name will list the operating system it supports in the middle of the file name.
Step 3: Installing the GAM Software
With a Windows download of the GAM software, you should be able to run the Microsoft Installer to install GAM on the computer. It should automatically install into a C:\GAM folder on the computer. You can later move the GAM installation to any folder you prefer.
With Macintosh or Linux, you have the option of installing Google Apps Manager using a command prompt. With this method, you would not need to download the software from the GitHub website first. At the Mac or Linux command prompt, type:
bash <(curl -s -S -L https://git.io/install-gam)
This command should download the latest version of the GAM software automatically.
Step 4: Running the GAM Software
Following the installation of any OS version of the Google Apps Manager software, you should authorize the GAM software for administrative management. At the same time, you will be giving the GAM software the ability to operate with Google Workspace administrative privileges.
Open a command prompt on your computer and type:
gam info user
If presented with a list of options to select from, pick the one that will select all options in the list, usually the last option.
The Google Apps Manager software should open a webpage through which you can grant access to the associated Google Workspace account. For this step to work properly, you must have Workspace administrative privileges. And you must log in to your Workspace account as an administrator before granting access.
After this step, you can switch back to the command prompt screen. You should see some information about your Workspace account listed. You are then ready to begin issuing Google Apps Manager commands.