Categories
ajoBlog workflow

Batch commands for GAM on Mac OS

I use the GAM tool a lot to make updates to the Google domain at Streetsboro – it let’s me do things faster, and more efficiently that hitting each user in the domain admin panel. But, using a Mac brings its own issues, and while I could get a PC for this, I’ve just figured out how to do things on the Mac. Here’s how I run batch commands (to update hundreds of accounts in one go).

I use the GAM tool a lot to make updates to the Google domain at Streetsboro – it let’s me do things faster, and more efficiently that hitting each user in the domain admin panel.

But, using a Mac brings its own issues, and while I could get a PC for this, I’ve just figured out how to do things on the Mac.

Here’s how I run batch commands (to update hundreds of accounts in one go).

  1. Create the GAM command line
    1. Start with a spreadsheet that contains all the users’ emails you want to use / update.
    2. I use Google sheets, and usually use the =CONCATENATE or some other formula to create the command line for each account.
      1. Something like =CONCATENATE(“gam update user “,A1,” org /STAFF”), where A1=user account / email address.
    3. For example, to add the user to a specific org unit, your GAM command line might look like:
      1. gam update user asmith@email.com org /STAFF
  2. I copy the resulting command lines (the whole column), and paste into a new sheet, with Paste Special > Paste as Values Only…
  3. Download as resulting sheet as a .csv file
  4. Place the file in the GAM folder –> in my case, in /bin/gam  <– but, this depends on your GAM install!
  5. Rename the file to end in .sh  <– for shell
  6. Your file should now be something like    staffupdate.sh
  7. In Terminal on the Mac, run this command, making sure to point to the file:
    1. gam batch bin/gam/staffupdate.sh
  8. Terminal will now run the shell file as a batch, and run all the GAM commands for you!
  9. Done!