How to get a list of users in a specific Org Unit(OU) with their drive usage?

15,418 views
Skip to first unread message

Harshit Srivastava

unread,
Aug 18, 2016, 7:12:52 PM8/18/16
to Google Apps Manager
I have a no. of OU's created in for my domain.
I wanted to procure a list of people in a specific OU with their Drive usage (Drive size or no. of documents in their drive).
Google offers to download a list of all users in the domain, but not users in a specific OU.
Even if I am able to download a list of all users, it doesn't have the columns as in, which OU does the USER belong to and what is the size of his drive (0 or >0 would also work).
Do we have a way for the same in GAM?
If i get these details, I can perform a delete operation to remove unwanted users.

Julien POIROT

unread,
Aug 23, 2016, 6:39:55 AM8/23/16
to Google Apps Manager
Hi
Try this :

1st : get all users in your OU:

gam print users  query "orgUnitPath=/your_OU"> users_in_your_OU.csv

2nd : get the report on the user list

gam csv users_in_your_OU.csv gam report users user ~primaryEmail fields "accounts:gmail_used_quota_in_mb,accounts:drive_used_quota_in_mb,accounts:used_quota_in_mb"  > quota_usage.csv

The quota_usage.csv file contains all what you need.


Thanks to Ian Crew who explained this in https://connect.googleforwork.com/ideas/5802

Regards

Julien

Srivastava, Harshit

unread,
Aug 23, 2016, 6:55:27 AM8/23/16
to google-ap...@googlegroups.com

Hi Julien,

Thanks for your mail. I tried the below steps, but facing issues:

 

 

 

I used the below, but it returns an error.

The OU Id is correct as this is the name of the OU. When I run gam info org "/LDO Suspended", it returns results but for gam print users allfields…… it gives below error.

 

 

 

 

 

When I used the same with other Ou names (Collaboration). It worked fine.

 

 

 

Please advise.

 

 

 

 

 

Regards

Harshit

+91-9620266233

--
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 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/983e7dd7-bda7-4bf7-941b-307c54208750%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

Julien POIROT

unread,
Aug 23, 2016, 7:14:40 AM8/23/16
to Google Apps Manager
Can you try to rename your OU without the space in its name ?
LDO_Suspended insted of LDO Suspended

I guess this is why you have this error

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

Bounthanom Munxayaphom

unread,
Sep 19, 2017, 12:07:18 AM9/19/17
to GAM for G Suite
You will need to put the ' ' before the name of the OU

Example:

c:\GAM>gam print users  query "orgUnitPath='/zzz-Terminated Users'" > users_in_z
zz-Terminated_Users.csv

Alpay AKYOL

unread,
May 23, 2018, 3:07:31 AM5/23/18
to GAM for G Suite
Hello Bounthanom,
Maybe this conversation is over but i need similar something now.
if you can answer, i will appricate that.

If i want to exclude suspended users in that csv file, what should i do ?

Ross Scroggs

unread,
May 23, 2018, 8:26:51 AM5/23/18
to google-ap...@googlegroups.com

gam print users  query "orgUnitPath='/Path/To/OU'  isSuspended=False" > OU_NonSuspended_Users.csv

-- 
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.

Alpay Akyol

unread,
May 23, 2018, 9:53:09 AM5/23/18
to google-ap...@googlegroups.com
Thank you very much.

Tom Rubino

unread,
Jan 30, 2020, 12:21:14 PM1/30/20
to GAM for G Suite
Anyone know of a way to suppress the warning when running a print user query?

Getting all Users in G Suite account that match query (x...@xxx.com) (may take some time on a large account)...


+KimNilsson

unread,
Jan 31, 2020, 9:23:42 AM1/31/20
to GAM for G Suite
Why, tell us the real reason. :-)

Kevin Melillo ✉

unread,
Jan 31, 2020, 9:50:32 AM1/31/20
to GAM for G Suite
My guess is it is for parsing purposes.  That line is not really needed as part of the output.  

On Fri, Jan 31, 2020 at 9:23 AM +KimNilsson <there.is.no...@gmail.com> wrote:
Why, tell us the real reason. :-)

--
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.


--
photo
Kevin Melillo
Electronic Communications Analyst, Information Technology

Phone: 732.465.6609 | Mobile: 732-609-4331

Email: k.me...@ieee.org

445 Hoes Lane Piscataway, NJ 08854

Ian Crew

unread,
Jan 31, 2020, 9:58:33 AM1/31/20
to google-ap...@googlegroups.com
But that message goes to stderr, not stdout, so it wouldn’t affect any pipes or redirects.  

Ian

--
___
Ian Crew

IST-Architecture, Platforms and Integration (API)
Earl Warren Hall, Second Floor
University of California, Berkeley
Reply all
Reply to author
Forward
0 new messages