Reporting on Storage

140 views
Skip to first unread message

Simon Smart

unread,
Jun 29, 2022, 2:35:12 PM6/29/22
to GAM for Google Workspace
Hi folks

I'm trying to get a report of storage used for a large org (over 100k) so too much to actually pull using the storage report in the admin console

The API of the user report [UserUsageReport.get()] will for the same report do the trick I hope:
(https://developers.google.com/admin-sdk/reports/v1/appendix/usage/user/accounts)

Ideally I want to combine these two commands together: 
gam csv users.csv gam print users fields primaryEmail name.fullName orgUnitPath suspended lastLoginTime organizations.0.title [todrive or > output.csv]
command with 
gam report users parameters accounts:gmail_used_quota_in_mb,accounts:drive_used_quota_in_mb,accounts:gplus_photos_used_quota_in_mb,accounts:total_quota_in_mb [todrive or > output.csv]

Is the easiest method going to be just to combine the two outputs in sheets or could I be using GAM in a fancier way to have this combined together in a single output?

From the print users command I want the fields:
primaryEmail
name.fullName
orgUnitPath
suspended
lastLoginTime
organizations.0.title

From the report users command I want the fields:
gmail_used_quota_in_mb
drive_used_quota_in_mb
gplus_photos_used_quota_in_mb
total_quota_in_mb

Appreciate any thoughts in advance
Si

Simon Smart

unread,
Jun 29, 2022, 3:36:47 PM6/29/22
to GAM for Google Workspace
Sorry I know I've got the commands slightly wrong there... here's a correction but I'm sure they can be made more efficient...

I got the list of users with the licence I'm wanting to target... these are now in 'users.csv'

1st command will get the list of users and standard 'print user' fields:
gam csv users.csv gam user ~email print user fields primaryEmail fullName orgUnitPath suspended lastLoginTime organizations todrive

This seems to output to several different Sheets rather than combining the results... I probably need to do the batch processing in a different way...

2nd command:
gam csv users.csv gam report user select ~email parameters accounts:gmail_used_quota_in_mb,accounts:drive_used_quota_in_mb,accounts:gplus_photos_used_quota_in_mb,accounts:used_quota_in_mb todrive

Again this outputs to a seperate Sheet per user instead of a single report.

Would appreciate any advice from the pros

Simon Smart

unread,
Jun 29, 2022, 4:01:37 PM6/29/22
to GAM for Google Workspace
Ok ok, update time... I think I've cracked how to combine the results... so here are my new commands


1st command will get the list of users and standard 'print user' fields:
gam redirect csv - multiprocess todrive tdtitle user-fields csv users.csv gam user ~email print user fields primaryEmail fullName orgUnitPath suspended lastLoginTime organizations


This seems to output to several different Sheets rather than combining the results... I probably need to do the batch processing in a different way...

2nd command:
gam redirect csv - multiprocess todrive tdtitle user-reports csv users.csv gam report user select ~email parameters accounts:gmail_used_quota_in_mb,accounts:drive_used_quota_in_mb,accounts:gplus_photos_used_quota_in_mb,accounts:used_quota_in_mb todrive

The second command seems to be working (is running now)... the first one however now reports that the user doesn't exist strangely...

Simon Smart

unread,
Jun 29, 2022, 4:02:23 PM6/29/22
to GAM for Google Workspace
ignore 'This seems to output to several different Sheets rather than combining the results... I probably need to do the batch processing in a different way...' from that last post...

Simon Smart

unread,
Jun 29, 2022, 4:26:16 PM6/29/22
to GAM for Google Workspace
UPDATE:

The two commands are working now:

1st command will get the list of users and standard 'print user' fields:
gam redirect csv - multiprocess todrive tdtitle user-fields csv users.csv gam user ~email print user fields primaryEmail fullName orgUnitPath suspended lastLoginTime organizations

2nd command will pull the report detailing storage for each user:
gam redirect csv - multiprocess todrive tdtitle user-reports csv users.csv gam report user select ~email parameters accounts:gmail_used_quota_in_mb,accounts:drive_used_quota_in_mb,accounts:gplus_photos_used_quota_in_mb,accounts:used_quota_in_mb todrive

Once they're both done I'll combine the two

So its now just an efficiency question. Should I be doing anything to reduce the number of API calls firstly and secondly is the question of 'Is there a way of combining the two commands above?'

Thanks
Simon

Ross Scroggs

unread,
Jun 29, 2022, 4:43:30 PM6/29/22
to google-ap...@googlegroups.com
Simon,

Send me a Meet/Zoom invitation and we'll discuss.

Ross

--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/2e0a91df-4026-4e3a-bdd8-93d54d851201n%40googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages