Delete Multiple Groups

615 views
Skip to first unread message

Liron Levi

unread,
Dec 26, 2016, 9:04:38 AM12/26/16
to GAM for G Suite
Hello,
I am new here in this forum. Can someone advise how I can delete multiple groups that no member exist in those groups?
Thank you.

This message may contain confidential and/or privileged information. 
If you are not the addressee or authorized to receive this on behalf of the addressee you must not use, copy, disclose or take action based on this message or any information herein. 
If you have received this message in error, please advise the sender immediately by reply email and delete this message. Thank you.

Ross Scroggs

unread,
Dec 26, 2016, 12:12:19 PM12/26/16
to google-ap...@googlegroups.com
Liron,

By empty group do you mean no members or no members or managers or owners?

There is no direct way to to this with standard Gam. If you say: gam print groups members managers owners delimiter "|" > groups.csv
groups.csv will have four columns: Email,Members,Managers,Owners
Email is the email address of the group, Members, Managers and Owners have lists of email addresses of each type separated by "|".
You'll have to select those rows where all of the lists you care about are empty and then delete those groups.

My versions of gam let you say: gam print groups memberscount managerscount ownerscount  > groups.csv
groups.csv will have four columns: Email,Members,Managers,Owners
Email is the email address of the group, Members, Managers and Owners have the counts of each type.
You'll have to select those rows where all of the counts you care about are 0 and then delete those groups.

If by empty group you mean a group with no members, managers or owners, then my versions given you a faster way to get the data you need.
Say: gam print groups directmemberscount > groups.csv
groups.csv will have two columns: Email,DirectMembersCount
Email is the email address of the group and DirectMembersCount is the count of all types.
You'll have to select those rows where DirectMembersCount is 0 and then delete those groups.

Ross
--
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.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/f47c2ea1-a678-4a3d-b9a1-152966253c10%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ross Scroggs

unread,
Dec 26, 2016, 12:19:06 PM12/26/16
to google-ap...@googlegroups.com
Liron,

is a drop-in replacement for standard GAM; you don't create a new project or any new authorizations, just install and go.

On Dec 26, 2016, at 5:59 AM, Liron Levi <lir...@liveperson.com> wrote:

Liron Levi

unread,
Dec 26, 2016, 2:16:05 PM12/26/16
to GAM for G Suite
Hey Ross,
First, thank you for your reply. I meant no member, owner is in those groups.
I use Mac, I will try your instructions and will update.
Regards, 

On Monday, December 26, 2016 at 7:19:06 PM UTC+2, Ross Scroggs wrote:
Liron,

is a drop-in replacement for standard GAM; you don't create a new project or any new authorizations, just install and go.

On Dec 26, 2016, at 5:59 AM, Liron Levi <lir...@liveperson.com> wrote:

Hello,
I am new here in this forum. Can someone advise how I can delete multiple groups that no member exist in those groups?
Thank you.

This message may contain confidential and/or privileged information. 
If you are not the addressee or authorized to receive this on behalf of the addressee you must not use, copy, disclose or take action based on this message or any information herein. 
If you have received this message in error, please advise the sender immediately by reply email and delete this message. Thank you.

--
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-manager+unsub...@googlegroups.com.

Liron Levi

unread,
Dec 26, 2016, 3:32:55 PM12/26/16
to GAM for G Suite
Hey Ross,
I tried your instructions, but the issue didn't solve. I run the script but nothing happened.
Please advice.

Ross Scroggs

unread,
Dec 26, 2016, 4:01:26 PM12/26/16
to google-ap...@googlegroups.com
Liron,

Do: gam version
Show me the command you ran.

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 https://groups.google.com/group/google-apps-manager.

Ross Scroggs

unread,
Dec 26, 2016, 4:14:02 PM12/26/16
to google-ap...@googlegroups.com
Liron,

Since you want to delete completely empty groups, do the following with my version.
gam print groups directmemberscount > groups.csv
echo "Email,DirectMembersCount" > delgroups.csv
grep ",0" groups.csv >> delgroups.csv
more delgroups.csv
# Make sure this looks right, if so, proceed
gam csv delgroups.csv gam delete group "~Email"

On Dec 26, 2016, at 12:32 PM, Liron Levi <lir...@liveperson.com> wrote:

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 https://groups.google.com/group/google-apps-manager.

Liron Levi

unread,
Dec 27, 2016, 3:55:38 AM12/27/16
to GAM for G Suite
Hey Ross,

my version is GAM 4.03

I created a .CSV file and it's on my desktop. how should I start with the command that you shared with me?


Regards,

Liron Levi

unread,
Dec 27, 2016, 3:58:00 AM12/27/16
to GAM for G Suite
This is what I run

gam print groups directmemberscount > groups.csv (the CSV path is my local path).

Regards, 

Liron Levi

unread,
Dec 27, 2016, 5:36:33 AM12/27/16
to GAM for G Suite
I received an error after command was run :

ERROR: directmemberscount is not a valid argument for "gam print groups"

Please advice.

Ross Scroggs

unread,
Dec 27, 2016, 8:00:25 AM12/27/16
to google-ap...@googlegroups.com
Liron,

You are not running my version of Gam, the version should be: GAM 4.03.22 - https://github.com/taers232c/GAM-B
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 https://groups.google.com/group/google-apps-manager.

Liron Levi

unread,
Dec 28, 2016, 8:52:08 AM12/28/16
to GAM for G Suite
Hey Ross,

Ok, I update to your version. Still, when the command (gam print groups directmemberscount > groups.csv)is run he didn't do anything. 

Can you please update,

Kevin Melillo

unread,
Dec 28, 2016, 9:02:36 AM12/28/16
to google-ap...@googlegroups.com
When that command is run, you did not get a CSV file created in the current directory?  This CSV file should include all output for the command.

Hey Ross,

To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsubscri...@googlegroups.com.

This message may contain confidential and/or privileged information. 
If you are not the addressee or authorized to receive this on behalf of the addressee you must not use, copy, disclose or take action based on this message or any information herein. 
If you have received this message in error, please advise the sender immediately by reply email and delete this message. Thank you.

-- 
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-manager+unsubscri...@googlegroups.com.

This message may contain confidential and/or privileged information. 
If you are not the addressee or authorized to receive this on behalf of the addressee you must not use, copy, disclose or take action based on this message or any information herein. 
If you have received this message in error, please advise the sender immediately by reply email and delete this message. Thank you.

-- 
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-manager+unsubscri...@googlegroups.com.

To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
This message may contain confidential and/or privileged information. 
If you are not the addressee or authorized to receive this on behalf of the addressee you must not use, copy, disclose or take action based on this message or any information herein. 
If you have received this message in error, please advise the sender immediately by reply email and delete this message. Thank you.

--
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-manager+unsub...@googlegroups.com.
To post to this group, send email to google-apps-manager@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Kevin Melillo
Electronic Communications Analyst
Information Technology
445 Hoes Lane
Piscataway, NJ 08854


Liron Levi

unread,
Dec 28, 2016, 10:07:09 AM12/28/16
to GAM for G Suite
File is created but with no content in it.
Hey Ross,

To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.

This message may contain confidential and/or privileged information. 
If you are not the addressee or authorized to receive this on behalf of the addressee you must not use, copy, disclose or take action based on this message or any information herein. 
If you have received this message in error, please advise the sender immediately by reply email and delete this message. Thank you.

-- 
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-manager+unsub...@googlegroups.com.

This message may contain confidential and/or privileged information. 
If you are not the addressee or authorized to receive this on behalf of the addressee you must not use, copy, disclose or take action based on this message or any information herein. 
If you have received this message in error, please advise the sender immediately by reply email and delete this message. Thank you.

-- 
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-manager+unsub...@googlegroups.com.

To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.

This message may contain confidential and/or privileged information. 
If you are not the addressee or authorized to receive this on behalf of the addressee you must not use, copy, disclose or take action based on this message or any information herein. 
If you have received this message in error, please advise the sender immediately by reply email and delete this message. Thank you.

--
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-manager+unsub...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.

Ross Scroggs

unread,
Dec 28, 2016, 10:11:49 AM12/28/16
to google-ap...@googlegroups.com
Liron,

Post the output from the following commands:
gam version
gam print groups directmemberscount

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 https://groups.google.com/group/google-apps-manager.
Reply all
Reply to author
Forward
0 new messages