Pages

Monday, October 27, 2014

GAFE: Unsuspending entire OU with 1 command using GAM

We accidentally suspended our last year seniors via the Google Apps Directory Sync and we needed a way to unsuspend them all at once. Awhile ago, I asked this question on the GAFE Admins Google+ Community and I received lots of help. It took awhile to get something to work but what I ended up doing was:

Using GAM
  1. gam print users allfields todrive (this downloads a csv to your drive of all of your users)
  2. Downloaded that CSV file.
  3. Opened in Filemaker Pro (or Excel) and find the users you want to unsuspend.
  4. Once you have the list of usernames use the formula in column B =CONCATENATE("gam update user ", A1, " suspended off")
  5.  Copy column B into a CSV file and save it as a .bat file
  6. Put it in the GAM folder directory
  7. Run the bat file with gam batch myfile.bat
 *I ran into issues because I was on a Mac and the csv format wasn't working. I saved the CSV on a Windows computer to get the .bat file to work.

*Using the formula in step #4 just quickly made the following command: gam update user user1@isd271.org suspended off 


I had to do this again today and I was able to get a much easier way to work! I followed directions on the same thread. I must not have been doing it right the first time.

Using GAM
  1. gam print users query orgUnitPath="/Student/HS/Kennedy/2014" | gam csv - gam update user ~Email suspended off 

That's it! There are 2 commands going on, getting the list of users in that OU and then performing the action to unsuspend them all. Using the pipe ( | ) allows for 2 commands to be done on one line.

 *I had to use ~Email and not ~PrimaryEmail (like it says in the thread)


Helpful links

2 comments:

  1. Under GAM in 2017 the command would be gam ou "/Student/HS/Kennedy/2014" update user suspended on

    ReplyDelete
  2. Hi. I would like to know what is the code for bulk suspension of google accounts using GAM?

    Thanks

    ReplyDelete