This lesson is part of the "TAMING GAM - A practical guide to GAM and GAMADV-XTD3" course.

What confidential information do your staff have? Do some of them have access to credit card numbers that they are not supposed to know about? Are they sending out CVs on company time? Do they have company secrets saved on their Google Drive?

If I have scared you, I meant to. It is a nice way to get you hooked into a blog article 🙂

But if your staff have access and have saved this information in their Google Drives and you are not aware of it, you have no idea what they might want to do with that information in the future or maybe what they have already done with it.

Let's look at a very simple and quick way of searching your companies drives for information that you want to check for.

We are going to be looking for keywords using GAMADV-XTD3. If you are not sure how to install and get started with GAM, please see these articles.

GAMADV-XTD3 on Windows 10

GAMADV-XTD3 on Ubuntu Linux

GAMADV-XTD3 on macOS

GAMADV-XTD3 on Google Cloud Shell

If you are looking to upgrade your GAM then go to upgrade your installation of GAM?

Let's get started.

Firstly open up your command line, whether on Windows, macOS or Linux and type this command. This is searching through a user called Jim for the word "confidential".

gam user jim print filelist query "fullText contains 'confidential'" todrive

If you want to see all the fields in a Google Sheet, then you would use this command.

gam user jim print filelist query "fullText contains 'confidential'" allfields todrive

But what if you want to search for a Credit Card number in Google Drive? Well then this is what your script would look like. We are searching through everyone's Google Drive for a specific Credit Card number.

Searching in Google Drive for Confidential information.
gam all users print filelist query "fullText contains '4539931860264108'" allfields todrive

Other Search Queries

File Content with Exact Phrase "Credit Card". I am just searching in Jim's Google Drive.

gam user jim print filelist query "fullText contains '\"Credit Card\"'" todrive

File Content with words in same file. I am looking for a file that has the CEO's Credit card number "4539931860264108" and the word "ID". Here I am searching through all the users.

gam all users print filelist query "fullText contains '4539931860264108 ID'" todrive

Exact File name. We are searching through just Jim's Google Drive for the Exact file name of "Confidential Document"

gam user jim print filelist query "title = 'Confidential Document'" todrive

Part of a File name. Here we are searching through all the users in the Google Workspace domain and trying to find all files that have the word "Confidential" somewhere in the file name.

gam all users print filelist fields title filenamematchpattern ".*Confidential*.*" todrive

External Sharing

In this article we looked at external sharing, but here are a couple more examples. Here we are searching for owners of documents. You can specify an email address.

gam all users print filelist id name owners fullquery "'[email protected]' in owners" anyowner todrive

This query looks at anyone with a link who can edit your Google Drive Documents.

gam all users print filelist fields id,name,permissions,webViewLink pm type anyone withlink true role editor em todrive

What is next?

Make sure that your staff are not sharing private or confidential information with others on the internet. If you would like more information about how to secure and report on your Google Workspace with automated and simple tools, check out the full "TAMING GAM - A practical guide to GAM and GAMADV-XTD3" course for your Google Workspace. It is over 9 hours and has 50 pages of free resources!

This lesson is part of the "TAMING GAM - A practical guide to GAM and GAMADV-XTD3" course.

You and your staff are sharing files with your Google Drive inside and outside your company. The simplest way to do it is by making a file that anyone with a link can see. This is the most dangerous way of sharing. You have no idea who is looking at your files. You have are not aware if the person you shared the file with, decided to s

You, and your staff, are sharing files within your Google Drive, inside and outside your company. 

The simplest way to do this by making a file that anyone with a link can see. Unfortunately, this is the most dangerous way of sharing because you have no idea who is looking at your files or if their intentions are nefarious. You don't know if the person you shared the file with, decided to share the link with other people in their company. And, if they did so, what their intentions are.

Before we continue, we are going to be using GAMADV-XTD3 in this blog. If you are not sure how to install and get started with GAM, please see these articles.

GAMADV-XTD3 on Windows 10

GAMADV-XTD3 on Ubuntu Linux

GAMADV-XTD3 on macOS

GAMADV-XTD3 on Google Cloud Shell

If you are looking to upgrade your GAM then go to upgrade your installation of GAM?

Let's get started.

This lesson works with the python file created by Ross Scroggs here called GetSharedWithAnyoneDriveACLs.py

Get ACLs for all files

The first step is to get the ACLs for all the files. You can do it for either an individual user or for your entire domain. This first GAM script looks at a single user and exports all of their files to the Google Drive along with the ACLs with targeted headings.

gam user jim print filelist id title permissions todrive

This GAMADV-XTD3 script pushes all the users in your domain with a Google Drive to a Google Sheet with their drive permissions.

gam all users print filelist allfields permissions todrive

Using the scripts that are in the comments of the GetSharedWithAnyoneDriveACLs.py file.

gam config auto_batch_min 1 redirect csv ./filelistperms.csv multiprocess all users print filelist fields id,title,permissions,owners.emailaddress <PutQueryHere>

This script allows you to pick either "all users" or an individual user and then at the end of the script you have the option for a query. These are the 3 options:

DESIRED_ALLOWFILEDISCOVERY = 'Any' - query "visibility='anyoneCanFind' or visibility='anyoneWithLink'"
DESIRED_ALLOWFILEDISCOVERY = 'True' - query "visibility='anyoneCanFind'"
DESIRED_ALLOWFILEDISCOVERY = 'False' - query "visibility='anyoneWithLink'"

I would specifically like to look at all files that have been shared with anyone with a link, so my script looks like this.

gam config auto_batch_min 1 redirect csv ./filelistperms.csv multiprocess all users print filelist fields id,title,permissions,owners.emailaddress query "visibility='anyoneWithLink'"
Showing who is being shared as anyone with a link

The CSV that is generated is then exported to the GAM Work folder, if that is where you ran the script from. You will then be able to open the CSV in Google Sheets or Microsoft Excel. However, you do not have to open it.

Once you have created the filelistperms.csv file, with the first GAM command, you will then need to convert that file to a new file, called deleteperms.csv, using the GetSharedWithAnyoneDriveACLs.py. Run this script and this is what your output should look like in the command line.

python3 GetSharedWithAnyoneDriveACLs.py filelistperms.csv deleteperms.csv
python command running in the command line

Then inside your c:\GAMWork folder you will see the newly created file called deleteperms.csv. You can open it and look at it. You will see that the python script has cleaned up the script, changed the headers and simplified the permissions.

CSV showing anyone with a link files and IDs

You need to carefully look through this file and see if you need to remove anything from here. You are looking to remove the external sharing from files. So if there is a file in this CSV, the permissions will be removed in the next step. If you do not want the permissions removed, then remove it from this CSV file.

If you are happy that all the files that need to have their permssions removed are in the CSV, then close it and you can then run this script.

gam csv ./deleteperms.csv gam user "~Owner" delete drivefileacl "~driveFileId" "~permissionId"

The below is what your command line will look like. It shows you what files or folders have had their ACLs removed.

Removing the ACLs from files in Google Drive.

Now to test a final time. Run this script and then open the filelistperms.csv and check that the sharing is what you want.

gam config auto_batch_min 1 redirect csv ./filelistperms.csv multiprocess all users print filelist fields id,title,permissions,owners.emailaddress query "visibility='anyoneWithLink'"

What is next?

You can either be quite specific about removing permissions from your staff's files and folders or you can remove all external sharing in a couple of minutes, it is really up to you and what you want to do.

For a more complete understanding of how to use GAM and GAMADV-XTD3 for your Google Workspace, check out our full course of over 9 hours and 50 pages of free resources!

This lesson is part of the "TAMING GAM - A practical guide to GAM and GAMADV-XTD3" course.

In this video lesson, we will be walking through the process of upgrading GAMADV-XTD3 to the latest version. You can either watch the video below, or follow the images and steps detailed below.

If you are trying to install GAM rather than upgrading it, please refer to these other articles.

GAMADV-XTD3 on Windows 10

GAMADV-XTD3 on Ubuntu Linux

GAMADV-XTD3 on macOS

GAMADV-XTD3 on Google Cloud Shell

Let's get started.

This post was updated with new scripts on the 5th November 2021.

To see the article published by Ross Scroggs on GitHub, please see here.

Upgrading GAMADV-XTD3 on Windows 10 and 11

I found this post on the GAM for Google Workspace Google Group where Chris River posted a PowerShell Script on how to update your installation of GAM from whatever version you are running to the latest version.

Create a PS1 file by opening notepad and pasting this script into it and save it as a PS1 file into your GAMADV-XTD3 directory. Mine is located here C:\GAMADV-XTD3

if (.\gam version checkrc) {
  $releases = curl "https://api.github.com/repos/taers232c/GAMADV-XTD3/releases" | ConvertFrom-Json
  $dlurl = ($releases[0].assets | where {$_.name -like "*windows*64.zip"}).browser_download_url
  $dir = (Get-Location).Path
  (new-object System.Net.WebClient).DownloadFile($dlurl, "$dir\gamadv-xtd3-latest-windows-x86_64.zip")
  $oldchangeloglinescount=(Get-Content .\GamUpdate.txt | Select-String .*).count
  Expand-Archive "$dir\gamadv-xtd3-latest-windows-x86_64.zip" "$dir\" -Force
  mv "$dir\gamadv-xtd3\*" "$dir\" -Force
  rm "$dir\gamadv-xtd3\"
  $newchangeloglinescount=(Get-Content .\GamUpdate.txt | Select-String .*).count
  Get-Content .\GamUpdate.txt -Head ($newchangeloglinescount-$oldchangeloglinescount-1)
} else {
  # Nothing, GAM is already up-to-date
}

Then you just need to run the PowerShell script when you want to update the version of GAM. You can also setup the Windows Scheduler to run this PS1 file each month to keep you as up to date as possible.

Upgrading GAMADV-XTD3 on macOS, Ubuntu, Linux and Google Cloud Shell

Upgrading on these operating systems is much simpler than upgrading on Windows. All you have to do is run this script in the terminal.

Default path $HOME/bin

bash <(curl -s -S -L https://git.io/fhZWP) -l

If you need to specify a path.

bash <(curl -s -S -L https://git.io/fhZWP) -l -d <Path>

If you would like a bash script, a separate one was provided by Chris River.

oldchangeloglinescount=$(wc -l ~/bin/gamadv-xtd3/GamUpdate.txt | awk '{print $1;}')
bash <(curl -s -S -L "https://raw.githubusercontent.com/taers232c/GAMADV-XTD3/master/src/gam-install.sh") -l
newchangeloglinescount=$(wc -l ~/bin/gamadv-xtd3/GamUpdate.txt | awk '{print $1;}')
GREEN='\033[0;32m'
NC='\033[0m' # No Color
printf "${GREEN}This update includes the following changes:${NC}\n"
head -n $(($newchangeloglinescount - $oldchangeloglinescount)) ~/bin/gamadv-xtd3/GamUpdate.txt

What is next?

That was nice and simple. You now have a bright and shiny updated installation. 

Understanding the full capabilities of how to use GAM and GAMADV-XTD3 for your Google Workspace will increase your productivity and efficiency. Check out our full course of over 9 hours and 50 pages of free resources!

This lesson is part of the "TAMING GAM - A practical guide to GAM and GAMADV-XTD3" course.

In this video, we will be walking through the set up of GAMADV-XTD3 on a Google Cloud Shell. You can either watch the video below, or follow the images and steps detailed below.

If you are trying to install GAM on another operating system, please refer to these articles:

GAMADV-XTD3 on Windows 10

GAMADV-XTD3 on Ubuntu Linux

GAMADV-XTD3 on macOS

Are you however trying to just upgrade your installation of GAM?

Let's get started.

If you would like to try it yourself, you can start here.

Login to Google Cloud Shell

Firstly open Google Cloud Shell

Google Cloud Shell -Accept Permissions

Accept any permissions that are requested when you get to the URL.

Wait for the Google Cloud Shell Provisioning

Download And Install GAMADV-XTD3

Let's download the installation of GAMADV-XTD3 from the GitHub Releases page.

https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads

We need to install GAMADV-XTD3 in the terminal, so please run this command.

bash <(curl -s -S -L https://git.io/fhZWP)
GAMADV-XTD3 is now installed on teh cloud shell. Can you run a full browser on this machine

GAMADV-XTD3 is now installed on this shell. It then asks if you can run a full browser on this machine. You can't, so press N and enter.

The next question is whether you are ready to set up a Google API Project for GAM. We are going to press Y and enter.

Then enter your Google Workspace admin email.

Go to the following link to authorise the GAM API

You will see that files and folders have been created:

.gam and .gam/gamcache and Downloads

Also gam.cfg has been initialised.

However, there are a few files and folders missing. client_secrets.json oauth2.txt and oauth2service.json are not found.

Click or copy the URL that has been generated and paste it into a browser.

Sign in with an admin account and grant permissions.

GAM Project Creation permissions

Then copy the code and paste it into your terminal.

gam code
paste the gam code into the terminal

Once you run this, it starts enabling the APIs for your GAM Project.

Google APIs are created by GAM

The APIs have been enabled. Now click or copy the URL to create a Desktop App.

Go to URL to create the desktop app

You need to create the Desktop App. You can name the OAuth 2.0 client whatever makes sense to you. I have named mine "GAM Cloud Shell" so it is easy for me to find later.

create oauth client id for the desktop app

Once you click create, you will be presented with a Client ID and a Client Secret. These need to be pasted into the Cloud Shell in the respective positions.

oauth client secret and client id

The Project Creation is now complete. We now need to authorise GAM to perform Google Workspace management operations with the admin account. Press Y and enter.

We now need to authorise GAM to perform Google Workspace management operations with the admin account. Press Y and enter.

You will now need to select the APIs that you want to enable. If you want all of them, just select S or, if you are happy with the scopes, then press C and enter.

select the APIs that you want to enable

You will now be presented with a very long URL. This URL can also be found in the path in your shell. Mine is under /home/michael/bin/gamadv-xtd3/gamoauthurls.txt. Depending on how you are working, it might be easier to copy and paste it from there. In Google Cloud Shell, it normally allows you to click on the URL.

click url to enable the APIs

If the URL worked, then you will be asked to login to your admin account to allow the API scopes.

press allow for all the api scopes

Next you will be asked to copy and paste the code back into the terminal under the Verification Code.

copy and paste the code into the terminal

That completes the Admin Authorisation. The oauth2.txt file has been created. You need to now authorise GAM to manage the Google Workspace user data and settings by pressing Y and enter. Then enter an email of a regular Workspace user, not the admin account.

domain-wide delegation authentication fails

The Domain-Wide Delegation for the admin user on the regular user, fails. This is an expected result. It is really just testing all the APIs. You will need to add the permissions to this in the next step.

apis failed click the URL and then authorise again

Click on the link to open the browser and authorise the permissions.

We need to add a new client ID and click the authorise button. Then return to the terminal and reauthorise.

add new client id with all the scopes

Below you will see the completed installation.

  1. All API Scopes have passed
  2. You will see your Service Account Client Name
  3. The gam.cfg file is saved into that path
  4. To start working with GAMADV-XTD3, you need to restart the terminal shell using the command in green
gam installation complete and passed service account path to gamadv-xtd3

Now to test

Now run this to test that you are connected to your domain.

gam info domain
gam info domain

Congratulations, you are ready to run GAMADV-XTD3! You might also want to check out how to install GAM on Ubuntu to see how to add aliases and paths.

(Optional) Additional things you can run.

There are some other commands that can be run.

Additional Options

gam config customer_id xxxx domain xxxx.com timezone local save verify

What is next?

Well done on completing this quick lesson on how to get GAM set up for your domain on Google Cloud Shell. 

Understanding the full capabilities of how to use GAM and GAMADV-XTD3 for your Google Workspace will increase your productivity and efficiency. Check out this full course of over 9 hours and 50 pages of free resources!

This lesson is part of the "TAMING GAM - A practical guide to GAM and GAMADV-XTD3" course.

In this lesson, we will be walking you through the set-up of GAMADV-XTD3 on an Ubuntu Linux machine. You can either watch the video below or follow the images and steps detailed below.

If you are trying to install GAM on another operating system, please refer to these articles:

GAMADV-XTD3 on Windows

GAMADV-XTD3 on macOS

GAMADV-XTD3 on Google Cloud Shell

Are you however trying to just upgrade your installation of GAM?

Let's get started.

If you would like to try it yourself, you can start here.

Download And Install GAMADV-XTD3

Let's start by opening a terminal on Ubuntu and running this command.

bash <(curl -s -S -L https://git.io/fhZWP)

Once that has run, you will see that it has added the GAM Alias to the profile file.

Create GAMConfig and GAMWork Directories

Before you continue, open a separate terminal window to make a couple of directories using the MKDIR command.

GAMConfig and GAMWork

mkdir GAMConfig in the linux terminal

Check that the Alias has been created

Now we need to check that the alias for GAM is in our BASH Terminal using this command.

nano ~/.bashrc

This will open the nano editor. You can use whatever editor you are comfortable with.

Check the bash for the GAM alias

You will see in the last line there, my alias is defined using my path. This will obviously change based on the user that you are logged into your machine as. Once you have confirmed the GAM alias, you can close the nano editor, using CTRL X.

Create GAMADV-XTD3 Project in Google Workspace

Go back to the first terminal that you started in and answer the question on the screen. "Can you run a full browser on this machine?" And press the Y button and enter.

It should then say "GAM is now installed. Are you ready to set up a Google API project for GAM?" Just press Y again and enter.

Enter an Admin Email Address for Google Workspace.

Now type an admin email address that is present in Google Workspace.

Allow the GAM Project Creation in Google Workspace

Click allow on the screen that pops up in your browser to allow the GAM Project Creation to access the Google Account.

Back in the terminal, you will be asked to click on a URL. You can either right-click and copy it or directly click on it, depending on your Terminal Emulator and paste it in a browser.

Create the OAuth client ID

Create and desktop app and name the OAuth client ID for the GAM Project

In the browser that you have opened with the URL, select "Desktop app" and name the OAuth client ID that you are creating. I have simply called mine GAM Ubuntu or GAM Linux. Then click the create button.

Then copy the Client ID and Client Secret one at a time and paste it into the terminal in the respective places.

Now you need to press Y to "Authorize GAM to perform Google Workspace Management operations as your admin account".

Authorise GAM to perform Google Workspace Management operations

Select GAM Scopes

Then you need to select the scopes that you would like GAM to be responsible for. 

Each scope is represented by a number. You can either select all the scopes by pressing S, unselect all scopes by pressing U, or just continue by pressing C. If you need to select a scope that has a blank next to it, then type in the number that represents that scope. You can also, if it is supported, make it read-only by adding an R after the number.

Select authorised scopes for GAM

Now authorise the script in the browser window that pops up.

The authorisation of GAM is complete and now we need to authorise GAM to manage Google Workspace data and settings.

GAMADV-XTD3 is now authorised. We now also need to authorise GAM to manage Google Workspace user data and settings. To authorise that, just press Y again.

Now you need to type the email address of a regular Google Workspace user.

The authorisation for GAM will fail the first time

This will fail the first time. This is almost a test step. You will be asked to copy a very long URL and paste it into your browser to make this happen.

Select the full URL to authorise GAM

Please select from the top of the red arrow to end of the URL, at the second red arrow. And paste that URL into your browser.

Add a new client ID to Google Workspace

When you paste the URL into your browser you will come to this page. You just need to authorise by pressing the "Authorize" button.

You are now ready to retry the authorisation. Go back to your terminal and press Y. The scopes should all pass now.

You can either close your terminal and open it again, or run this command to get started right away.

alias gam="/home/paul/bin/gamadv-xtd3/gam"

Please make sure that you adapt it for your path.

Testing GAM on Ubuntu Linux

Now run this to test that you are connected to your domain.

gam info domain
GAMADV-XTD3 now runs on Ubuntu

Congratulations, you are ready to run GAMADV-XTD3!

(Optional) Additional things you can run.

There are some additional options that you can run.

Additional Options

gam config customer_id xxxx domain xxxx.com timezone local save verify

What is next?

Well done on completing this quick lesson on how to get GAM set up for your domain on Ubuntu. If you would like to understand the full capabilities of how to use GAM and GAMADV-XTD3 for your Google Workspace, check out this full course of over 9 hours and 50 pages of free resources!

This lesson is part of the "TAMING GAM - A practical guide to GAM and GAMADV-XTD3" course.

Here we will walk you through the set up of GAMADV-XTD3 on a macOS Virtual Machine. This will also work on any version of macOS.

You can either follow along with the images and steps below, or watch the video.

If you are trying to install GAM on another operating system, please refer to these articles:

GAMADV-XTD3 on Windows

GAMADV-XTD3 on Ubuntu Linux

GAMADV-XTD3 on Google Cloud Shell

Are you however trying to just upgrade your installation of GAM?

Let's get started.

If you would like to try it yourself, you can start here.

Download And Install GAMADV-XTD3

Let's download the installation of GAMADV-XTD3 from the Downloads page.

At the time of recording this video, we installed GAMADV-XTD3 6.06.09.

Start a terminal session and execute this command, for a new installation in the default path $HOME/bin

bash <(curl -s -S -L https://git.io/fhZWP)

Depending on how you have set up your macOS, you may be prompted to install the Command Line Tools.

Installing the Command Line tools for macOS

Once that has installed, which may take a couple of minutes, you will see this in your terminal.

bash <(curl -s -S -L https://git.io/fhZWP) Installation of GAMADV-XTD3 on macOS

Open a NEW terminal window.

We need to add a new line of code into the shell.

To get into your shell you will need to know what shell you are using. On a newish Mac, you are probably using ~/.zshrc. To see that this line was entered, we need to open a text editor. You can use whichever is on your machine, we are going to use Nano by running this command.

nano ~/.zshrc
Checking zshrc for the config line created by GAMADV-XTD3

As you can see, there is a line that was added by the installation. We need to add this line into the text editor. And then save the file. To save, use CTRL X and then press Y and then press enter.

export GAMCFGDIR="/Users/admin/GAMConfig"
Adding export GAMCFGDIR=

Now, let's create a GAMWork and GAMConfig directory in the macOS finder.

Create a GAMWork and GAMConfig directory in the macOS finder

We need to now move into the GAM folder. You will see that I started by running "ls". This will list the folders and files so that I can see where I am. Then I changed directory (cd see the red arrow) and moved myself into the bin/gamadv-xtd3 directory. I then ran "ls" again to see what was in that folder.

Moving into the GAMADV-XTD3 folder

Initialise GAMADV-XTD3

We then want to initialise GAMADV-XTD3 by running this command.

./gam config drive_dir /Users/admin/GAMWork verify

Verify the installation

ls -l ~/.gam

Now return to the first terminal window.

We can run a browser on this machine, so press Y

And then enter a Google Workspace email.

Setting up GAMADV-XTD3

Once you have added the admin email address, it will start running through the process of actually creating the Google App.

Create a GAM desktop App

Select the link provided and paste it into your browser. You will need to make a desktop app and name it something like GAM.

Then copy and paste your Client ID and Client Secret into the terminal.

Then copy and paste your Client ID and Client Secret into the terminal.

Now are you ready to authorise GAM to perform Google Workspace Management Operations? Just type Y

GAM API Scopes

Now choose the API you would like to authorise. You can select all scopes by using S, Unselect all using U, or press C to continue to Authorisation. If you would like to enable or disable API Scopes, you can just type the numbers that correspond to the various Scopes, and they will enable or disable.

If you would like to enable or disable API Scopes, you can just type the numbers that correspond to the various Scopes, and they will enable or disable.

When you press C you will be transferred to your Workspace and you will have to click allow authorising.

When you press C you will be transferred to your Workspace and you will have to click allow authorising.

Then back at the terminal, press Y to advise you are ready to authorise and then type in a regular Workspace user.

These will all fail the first time it runs.

API Scopes are all failing

Then copy and paste the long link from your terminal into your browser.

Copy the URL to authorise Google Workspace

Then we need to authorise the new Client ID.

Then we need to authorise the new Client ID.

Then go back to the terminal and try again by pressing Y and you will see the scopes all passing.

Then go back to the terminal and try again by pressing Y and you will see the scopes all passing.

Either copy and paste the command from your terminal to restart the terminal or just close and open it again. Then we are going to test that it works by running this command.

gam info domain

(Optional) Additional things you can run.

There are some other options that are suggested that you can run.

Additional Options

gam config customer_id xxxx domain xxxx.com timezone local save verify

What is next?

So that was a quick lesson on how to get GAM set up for your domain on macOS. If you would like more info on how to use GAM and GAMADV-XTD3 for your Google Workspace, check out this full online course of over 9 hours, including 50 pages of free resources, here.

This lesson is part of the "TAMING GAM - A practical guide to GAM and GAMADV-XTD3" course.

This lesson walks you through the set up of GAMADV-XTD3 on a Windows 10 Virtual Machine. You can also load it directly on your Windows 10 machine by following along with either the video below, or by following the images and steps detailed below.

If you are trying to install GAM on another operating system, please refer to these articles:

GAMADV-XTD3 on Ubuntu Linux

GAMADV-XTD3 on Google Cloud Shell

GAMADV-XTD3 on macOS

Are you however trying to just upgrade your installation of GAM?

Let's get started.

If you would like to try it yourself, you can start here.

Download And Install GAMADV-XTD3

Let's download the installation of GAMADV-XTD3 from the GitHub Releases page.

At the time of recording this video, we installed GAMADV-XTD3 6.06.09.

Then run through the installation of your GAMADV-XTD3. Open the file you downloaded and click next all the way through. Make sure that you make a note of the path that you are installing in.

Installation of GAMADV-XTD3

Then make sure that it has installed into the correct path in your C Drive.

GAM Installation directory

Set a configuration directory

When you install GAM, the default GAM configuration directory is C:\Users.gam.

To make it easier to work with multiple companies, you may want to change it to a non user-specific location. This example assumes that the GAM configuration directory will be C:\GAMConfig; If you've chosen another directory, substitute that value in the directions.

Make the C:\GAMConfig directory before completing the rest of the steps.

Set a working directory

Another tip, to make your processing of commands easier, is to create a GAM working directory.

In this folder you will execute commands from this folder. You should not use C:\GAMADV-XTD3 or C:\GAMConfig for this purpose.

Make the C:\GAMWork directory before completing the rest of the steps.

Create GAMConfig and GAMWork

Set system path and GAM configuration directory

Start Control Panel

Open Control Panel

Click System

Open System in Control Panel

Click Advanced system settings

Click Advanced System Settings

Click Environment Variables

Click Environment Variables…


Click Path under System variables and Click Edit.

Click Path under System variables


If C:\GAMADV-XTD3 is already on the Path, skip the next three steps
Click New
Enter C:\GAMADV-XTD3

Click New
Enter C:\GAMADV-XTD3


Click OK
Click New
Set Variable name: GAMCFGDIR
Set Variable value: C:\GAMConfig
Click OK

Set Variable value: C:\GAMConfig
Click OK


Click OK
Click OK
Exit Control Panel

Initialise GAMADV-XTD3

Open the command prompt and run this command to get into the GAMADV-XTD3 directory.

cd C:\GAMADV-XTD3

Then run this command to initialize GAM

gam config drive_dir C:\GAMWork verify
gam config drive_dir C:\GAMWork verify

Verify initialisation

Once the previous command has run, run this command to verify that the GAM installation has initialised.

dir %GAMCFGDIR%
dir %GAMCFGDIR%

Start Creating your GAM Project

If you still have the command prompt open, then run the below command to create the GAM Project.

gam create project

Then add your Google Admin or GCP Project Manager account to the GAM command

Then, once it runs, copy the link from the command prompt and paste it into your browser.

Then, once it runs, copy the link from the command prompt and paste it into your browser.

Choose Desktop APP

Choose Desktop APP

Name your OAuth Client ID

Name your OAuth Client ID

Now that your OAuth Client has been created, copy your Client ID and Client Secret into the command prompt.

image 18

Now we need to create the OAuth connection.

gam oauth create
The APIs with the stars next to them are going to be enabled.

The APIs with the stars next to them are going to be enabled. Make a selection of what APIs you want and then click "c" to continue. And enter your admin email.

Press allow to enable the APIs

Press allow to enable the APIs

Enable GAMADV-XTD3 service account access.

We now need to test that it has worked for a specific user.

gam user [email protected] check serviceaccount
gam user user@domain.com check serviceaccount

Copy the long URL for the authorisation and paste it into your browser.

 Copy the long URL for the authorisation and paste it into your browser.

Then click authorise.

Then click authorise.

Now to test

Run the same command as before to test that it is authorised.

gam user [email protected] check serviceaccount
Run the same command as before to test that it is authorised.

Now run this to test that you are connected to your domain.

gam info domain
Now run this to test that you are connected to your domain.

Congratulations, you are ready to run GAMADV-XTD3!

(Optional) Additional things you can run.

There are some other that are suggested that you can run.

Additional Options

gam config customer_id xxxx domain xxxx.com timezone local save verify

What is next?

So that was an quick lesson on how to get GAM set up for your domain on Windows 10. If you would like more info on how to use GAM and GAMADV-XTD3 for your Google Workspace, please check out this full course of over 9 hours here.

taers232c/GAMADV-XTD3: Command line tool to manage ... - GitHub
GAMADV-XTD3 is a free, open source command line tool for Google Workspace (formerly G Suite) Administrators to manage domain and user settings quickly and ...

Are you looking to do an advanced date matching and validation with Regular Expressions? Are you trying to make sure that your validation takes into account months with 30 and 31 days, and that pesky February who has 28 days and then every 4 years it has 29 days?!

Then this video below is for you!

Resources for Advanced Date Matching with Regex

https://regex101.com/r/9JIyQs/2 - Simple Example
https://www.debuggex.com/ - Regex Visualizer
https://jex.im/regulex/#!flags=&re=%5E(a%7Cb)*%3F%24 - Another Regex Visualizer
http://taming.tech/Google-Doc-Regex-Planning Thinking behind the Regex for a Date
https://regex101.com/r/YSSP9v/1 - Full Regex for date
https://regex101.com/r/YSSP9v/2 - Blank for you to start with
https://regex101.com/r/YSSP9v/3 - My completed example after demo

About this Regex Tutorial

We break down the complexity, of using 2 different examples of how to validate months using Regex, into bite size chunks. We go through the whole process from scratch and show you the thinking in how to formulate your expressions.

One of the difficulties with working on a new expression is being able to see where you have gone wrong, and then troubleshooting the expressions. Here we use a Regex Visualiser to show you how it works. How the validation goes from 1 side of the Regular Expression and gets thrown out of each leg and is only valid in one place.

In this tutorial we start with a simple example of how to validate against date entries. The problem with this Regex is that if you are looking to reject inputs that might be incorrect like 30/Feb/2001 then this will not stop those from being entered.

Simple Date Matching

(?<MM>[01]?[0-9])\/(?<DD>[0-3]?[0-9])\/(?<YYYY>[0-2][0-9][0-9][0-9])

If you look at the examples from this website https://www.regular-expressions.info/dates.html you will see that they start with this example.

^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$

You can see their code working here https://regex101.com/r/9ec0Ko/1 This still doesn't validate for months working on different days per month or leap years. They do however continue on to validate the dates using Perl code. This is in the yyyy-mm-dd format from 1900-01-01 through 2099-12-31.

sub isvaliddate {
  my $input = shift;
  if ($input =~ m!^((?:19|20)\d\d)[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$!) {
    # At this point, $1 holds the year, $2 the month and $3 the day of the date entered
    if ($3 == 31 and ($2 == 4 or $2 == 6 or $2 == 9 or $2 == 11)) {
      return 0; # 31st of a month with 30 days
    } elsif ($3 >= 30 and $2 == 2) {
      return 0; # February 30th or 31st
    } elsif ($2 == 2 and $3 == 29 and not ($1 % 4 == 0 and ($1 % 100 != 0 or $1 % 400 == 0))) {
      return 0; # February 29th outside a leap year
    } else {
      return 1; # Valid date
    }
  } else {
    return 0; # Not a date
  }
}

That is fine for their example, but I want to have my validation all in one line that can be adapted for Python, PHP, PowerShell etc. so this doesn't work for me.

So we start with a very complex looking expression. If you are happy to just copy and paste then you can use this. But if you want to learn how to do this, then please watch the video.

So we start with a very complex looking expression. If you are happy to just copy and paste then you can use this. But if you want to learn how to do this, then please watch the video.

^(?:(?:31(\/|-|\.)(?:0?[13578]|1[02]|(?:Jan|Mar|May|Jul|Aug|Oct|Dec)))\1|(?:(?:29|30)(\/|-|\.)(?:0?[1,3-9]|1[0-2]|(?:Jan|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec))\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(\/|-|\.)(?:0?2|(?:Feb))\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\d|2[0-8])(\/|-|\.)(?:(?:0?[1-9]|(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep))|(?:1[0-2]|(?:Oct|Nov|Dec)))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$

Check it out here https://regex101.com/r/YSSP9v/1 We have used the UK and South African date format here of DD/MM/YYYY. You can obviously update this to the international date format of YYYY/MM/DD.

After going through the validation and showing you how to work and troubleshoot your validation, I finished on this expression, which I actually like more than my original example.

^(?<Monthswith31>31(?<s1>\/|\.|-)(0?[13578]|1[02]|(Jan|Mar|May|Jul|Aug|Oct|Dec))\g<s1>(?<Year>19[0-9][0-9]|200[0-7]))$|^(?<Monthswith29or30>(29|30)(?<s2>\/|\.|-)(0?[1,3-9]|1[0-2]|(Jan|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec))\g<s2>(?<Year2>19[0-9][0-9]|200[0-7]))$|^(?<Allmonthswith28>(0?[1-9]|1[0-9]|2[0-8])(?<s3>\/|\.|-)(0?[1-9]|1[0-2]|(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec))\g<s3>(?<Year3>19[0-9][0-9]|200[0-7]))$|^(?<FebLeapYears>29(?<s4>\/|\.|-)(0?2|Feb)\g<s4>(19([02468][048]|[13579][26])|200[04]))$

You can play and test it for yourself here https://regex101.com/r/YSSP9v/3

We have worked with 4 "legs" in this Regex. One to validate all months with 31 days, so that would be Jan, Mar, May, Jul, Aug, Oct, Dec. Then we look at all months with 29 or 30 days, so that would be Jan, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec. Then all the months with 1-28 days so that is all months. Finally, we look at leap years that would have Feb 29 in years like 1996, 2000, 2004 etc. and we play with an easy way to figure out what the year would validate against.

This video is an hour long because I take you through my logic and thinking so that you can figure out any Regex that you would like to play with.

Udemy Regex Course

Taming REGEX

This tutorial is a part of a Regex course on Udemy. Join us using the Udemy Coupon code on that page to get the course for the best possible price.

Taming Tech
Copyright © 2022 Outsource House [OSH.co.za] | All Rights Reserved Website development powered by Doiing.Digital | Training produced by Taming.Tech