Bulk delete Google Apps users with GAM

4,923 views
Skip to first unread message

Eric Keiper

unread,
Aug 19, 2015, 10:13:39 AM8/19/15
to google-ap...@googlegroups.com


Hello,

I am having issues trying to bulk delete users in our Google Apps for Ed account. 

I have used GAM to do a lot of things in the past but I cannot seem to get it to do what I need now. 

I tried using the command:

while IFS=, read username; do python gam.py delete user $username; done < deleteusers.csv

but I get the error: Error 403: Not Authorized to access this resource/api - forbidden


I was really hoping someone would be able to help me in some way, maybe a new command that works to do what I need. 

I am running GAM on my MacBook Pro running OS X 10.10.3.

Thanks,
Eric

Jay Lee

unread,
Aug 19, 2015, 12:05:58 PM8/19/15
to google-ap...@googlegroups.com
Try:

gam csv deleteusers.csv gam delete user ~username

this assumes that the CSV file has a column with username as the heading and contains the email addresses to be deleted.

Jay

--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/CAJuGqD5fUmm%3D8jY2N11OBVggUhtewjP84aFP4WgsqGyd4V1mvg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--

Jay Lee

EKeiper

unread,
Aug 19, 2015, 1:20:51 PM8/19/15
to Google Apps Manager
This does exactly what I need. Thanks so much Jay. I really appreciate all the help. 

Now I just need to figure out how to get all 7000 new accounts in at once. 

Eric


On Wednesday, August 19, 2015 at 12:05:58 PM UTC-4, Jay Lee wrote:
Try:

gam csv deleteusers.csv gam delete user ~username

this assumes that the CSV file has a column with username as the heading and contains the email addresses to be deleted.

Jay

On Wed, Aug 19, 2015 at 10:13 AM Eric Keiper <kei...@eastonsd.org> wrote:


Hello,

I am having issues trying to bulk delete users in our Google Apps for Ed account. 

I have used GAM to do a lot of things in the past but I cannot seem to get it to do what I need now. 

I tried using the command:

while IFS=, read username; do python gam.py delete user $username; done < deleteusers.csv

but I get the error: Error 403: Not Authorized to access this resource/api - forbidden


I was really hoping someone would be able to help me in some way, maybe a new command that works to do what I need. 

I am running GAM on my MacBook Pro running OS X 10.10.3.

Thanks,
Eric

--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
--

Jay Lee

Jake Schaaf

unread,
Aug 19, 2015, 2:49:59 PM8/19/15
to Google Apps Manager
Eric,

Just did the same mass delete then add today myself and it ran like a champ.

gam csv creates.csv gam create user ~mail firstname ~givenName lastname ~sn


creates.csv had columns with the headers: mail, givenName and sn


mail=google email (username)

givenName=first name

sn=last name


I know the column headings are goofy, used same ones from some other software using the same files for. ;) 


Then moved them into different orgs after breaking down the groups into different cvs files (6th grade, 5th grade, etc)

EKeiper

unread,
Aug 19, 2015, 2:52:27 PM8/19/15
to Google Apps Manager
Jake,

Thanks for the reply. I found something that seems to be working. Not sure if it will actually move them into the OU during creating. 

python gam.py csv NewUsers.csv gam create user ~Email firstname ~FN lastname ~LN password ~PWD org ~OU changepassword off gal off


I'll post up whether this works or not.

Eric

Knowing Technologies

unread,
Sep 18, 2017, 9:52:51 PM9/18/17
to GAM for G Suite
Hi Jay I have tried a bunch of different combos to try to delete 200+ email accounts but I keep getting a 'no such file or directory' error. I have the csv file saves to the gam folder. Is there anything else I am missing?


On Wednesday, August 19, 2015 at 9:05:58 AM UTC-7, Jay Lee wrote:
Try:

gam csv deleteusers.csv gam delete user ~username

this assumes that the CSV file has a column with username as the heading and contains the email addresses to be deleted.

Jay

On Wed, Aug 19, 2015 at 10:13 AM Eric Keiper <kei...@eastonsd.org> wrote:


Hello,

I am having issues trying to bulk delete users in our Google Apps for Ed account. 

I have used GAM to do a lot of things in the past but I cannot seem to get it to do what I need now. 

I tried using the command:

while IFS=, read username; do python gam.py delete user $username; done < deleteusers.csv

but I get the error: Error 403: Not Authorized to access this resource/api - forbidden


I was really hoping someone would be able to help me in some way, maybe a new command that works to do what I need. 

I am running GAM on my MacBook Pro running OS X 10.10.3.

Thanks,
Eric

--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
--

Jay Lee

Ross Scroggs

unread,
Sep 18, 2017, 10:44:03 PM9/18/17
to google-ap...@googlegroups.com
It's always helpful if you include the exact command that you are trying to execute.
Show us the command and the output.

You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.

To post to this group, send email to google-ap...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages