| by TheIneptOne | No comments

Changing Primary Email Addresses with GAM

I recently completed a project where I had to change the primary email address of hundreds of accounts across our Google Workspaces tenant. I needed to do this quickly without disruption… GAM to the rescue!

CSV File

To start off, I exported all accounts to a CSV file named new_addresses.csv and then created 2 columns named OldAddress and NewAddress.

All the user accounts were added to the OldAddress column and the added the new addresses to the NewAddress column.

Updating with GAM

GAM will pull the information from the CSV file utilizing ~HeaderName in the command below

gam csv C:\GAM\new_addresses.csv gam update user ~CurrentAddress email ~NewAddress

GAM will scroll by while processing and any errors will show on screen. Optionally, if you’re processing a large number of user, you can output the command to a text file by appending > log.txt | type log.txt to the end of the command in Windows.

gam csv C:\GAM\new_addresses.csv gam update user ~OldAddress email ~NewAddress > log.txt | type log.txt

This will both save the output to a file called log.txt as well as display the output in the command prompt.

Deleting with GAM

If you don’t want or need the old email address as an alias, you can delete the alias by running the command below utilizing the same CSV file

gam csv C:\GAM\new_addresses.csv gam delete alias user ~OldAddress

 

Leave a Reply