I need to remove all groups from a email account

104 views
Skip to first unread message

Joey Pistone

unread,
Aug 31, 2013, 9:56:24 AM8/31/13
to google-ap...@googlegroups.com
As users leave the org I like to remove them from their groups and suspend their account. Is there a way to remove a user from ALL of their groups? In Version 2.55 I used this shell script I wrote. 


But in the most recent release when you list user info it doesn't show you {direct | indirect} any more. 

Is there another way of doing this? 

- Joe

Mike Verdeyen

unread,
Aug 31, 2013, 4:22:50 PM8/31/13
to google-ap...@googlegroups.com
here's a snippet of a script I've written for Gam3:

for grp in `gam info user $term_user | sed -n '/Groups/,//p' | grep -v "Groups:" | sed 's/.*\<\([a-zA-Z0-9_.@\-]*\)\>.*/\1/' ` ; do echo "gam update group $grp remove member $term_user;" ; done
Message has been deleted

Joey Pistone

unread,
Sep 3, 2013, 10:06:30 AM9/3/13
to google-ap...@googlegroups.com
Hey Mike, 

Thanks for the snippet. I changed it around a little bit. Anyway here is what I came up with. https://github.com/daguy666/killingtime/blob/master/Gam_Commands/removegroups_gam3.sh

Mike Verdeyen

unread,
Sep 3, 2013, 3:02:54 PM9/3/13
to google-ap...@googlegroups.com
looks good.  I've got a set of scripts and processes I use to onboard/offboard users as well as other admin type tasks.  Much of it is tied to my environment and process which is why I just grabbed a snippet in this case.  I am thinking about getting the entire set documented up a bit better and then sharing out via git.  Anyway...if I get something that I think is sharable, I will post a link back here.   If nothing else, it might be useful for others out there.
Reply all
Reply to author
Forward
0 new messages