GAM to download a copy of users drive/email.

8,722 views
Skip to first unread message

Robert Robinson

unread,
Nov 22, 2016, 5:38:15 AM11/22/16
to GAM for G Suite
We're looking at a way of archiving users data that have left. Transfer Ownership isn't always necessary and was wondering if it's possible to download the contents of a users drive and emails using GAM. The only other option we have is Google Takeout but this isn't very convenient when you have lots of students leaving at the same time. Would be nice to have a way to automate it.

Bob J

unread,
Nov 28, 2016, 2:08:44 PM11/28/16
to GAM for G Suite
I'm just starting to look into look into this as well using GAM with got-your-back.  I'm not sure if there's a simpler method available, but I'm starting to research automating the GYB token authorization flow.  We've been suspending user accounts when employees depart, so the workflow to download the email is something like:
  1. Use GAM to un-suspend the user account, reset the password, and generate/pull a 2FA code.
  2. Authenticate to the gmail account.
  3. Run GYM, authorize the token in the authenticated session, and then download all the user's email.
Not necessarily the simplest or best method, but should save a significant amount of time for me against the 200+ accounts I'd like to remove from our G Suite account.

Jay Lee

unread,
Nov 28, 2016, 2:10:38 PM11/28/16
to GAM for G Suite
It'd be easier to just setup GYB with service accounts:


I realize that wiki article is out of date, it's on my todo list to automate the service account setup for GYB like we've done recently for GAM.

Jay

--
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/6db3e1a9-955d-4a11-9534-74237c4c8688%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Jay

Paul K

unread,
Apr 6, 2018, 3:44:39 PM4/6/18
to GAM for G Suite
Wow. GYB looks awesome. Does anyone know of a similar tool for Drive? It would be nice to be able to make something like Takeouts generates without needing to reset the user's password. GAM doesn't look very well setup for bulk transfer (which maybe is just because the APIs aren't well setup for that?)

--
Paul


On Monday, November 28, 2016 at 1:10:38 PM UTC-6, Jay Lee wrote:
It'd be easier to just setup GYB with service accounts:


I realize that wiki article is out of date, it's on my todo list to automate the service account setup for GYB like we've done recently for GAM.

Jay

On Mon, Nov 28, 2016 at 2:08 PM Bob J <b...@tune.com> wrote:
I'm just starting to look into look into this as well using GAM with got-your-back.  I'm not sure if there's a simpler method available, but I'm starting to research automating the GYB token authorization flow.  We've been suspending user accounts when employees depart, so the workflow to download the email is something like:
  1. Use GAM to un-suspend the user account, reset the password, and generate/pull a 2FA code.
  2. Authenticate to the gmail account.
  3. Run GYM, authorize the token in the authenticated session, and then download all the user's email.
Not necessarily the simplest or best method, but should save a significant amount of time for me against the 200+ accounts I'd like to remove from our G Suite account.


On Tuesday, November 22, 2016 at 2:38:15 AM UTC-8, Robert Robinson wrote:
We're looking at a way of archiving users data that have left. Transfer Ownership isn't always necessary and was wondering if it's possible to download the contents of a users drive and emails using GAM. The only other option we have is Google Takeout but this isn't very convenient when you have lots of students leaving at the same time. Would be nice to have a way to automate it.

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

Jay

Yehuda Y

unread,
Jul 16, 2018, 11:04:14 AM7/16/18
to GAM for G Suite
Yes, you can use GAM for this.

Yehuda Y

unread,
Jul 17, 2018, 2:44:23 AM7/17/18
to GAM for G Suite
Sorry, this is the correct link
https://github.com/jay0lee/GAM/wiki/GoogleDriveManagement#examples-3

On Monday, 16 July 2018 18:04:14 UTC+3, Yehuda Y wrote:
> Yes, you can use GAM for this.
> Look on this example: https://groups.google.com/forum/#!topic/google-apps-manager/XtM6ZwduHJA
>
> On Friday, 6 April 2018 22:44:39 UTC+3, Paul K wrote:
> Wow. GYB looks awesome. Does anyone know of a similar tool for Drive? It would be nice to be able to make something like Takeouts generates without needing to reset the user's password. GAM doesn't look very well setup for bulk transfer (which maybe is just because the APIs aren't well setup for that?)
>
>
> --
> Paul
>
> On Monday, November 28, 2016 at 1:10:38 PM UTC-6, Jay Lee wrote:
> It'd be easier to just setup GYB with service accounts:
>
>
> https://github.com/jay0lee/got-your-back/wiki#google-apps-for-work-and-edu-admins-backup-restore-and-estimate-users-and-restore-to-groups
>
>
>
> I realize that wiki article is out of date, it's on my todo list to automate the service account setup for GYB like we've done recently for GAM.
>
>
> Jay
>
>
> On Mon, Nov 28, 2016 at 2:08 PM Bob J <b...@tune.com> wrote:
>
> I'm just starting to look into look into this as well using GAM with got-your-back.  I'm not sure if there's a simpler method available, but I'm starting to research automating the GYB token authorization flow.  We've been suspending user accounts when employees depart, so the workflow to download the email is something like:
> Use GAM to un-suspend the user account, reset the password, and generate/pull a 2FA code.Authenticate to the gmail account.Run GYM, authorize the token in the authenticated session, and then download all the user's email.
> Not necessarily the simplest or best method, but should save a significant amount of time for me against the 200+ accounts I'd like to remove from our G Suite account.
>
>
>
>
> On Tuesday, November 22, 2016 at 2:38:15 AM UTC-8, Robert Robinson wrote:
> We're looking at a way of archiving users data that have left. Transfer Ownership isn't always necessary and was wondering if it's possible to download the contents of a users drive and emails using GAM. The only other option we have is Google Takeout but this isn't very convenient when you have lots of students leaving at the same time. Would be nice to have a way to automate it.
>
>
>
>
>
>
> --
>
> 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.

Avrohom Eliezer Friedman

unread,
Jul 17, 2018, 10:10:33 AM7/17/18
to google-ap...@googlegroups.com
interesting

So running the command gam ou '/Students/Class of 2018' get drivefile query "'me' in owners" format microsoft on a linux machine will download all the files to /home/aefriedman_ytcteam_org/Downloads/ but it won't make any indication what user it's from. Optimally I would love if it could send to drive each users files into a folder titled by the username

is that at all possible?


-----
Avrohom Eliezer Friedman
IT Director

Yeshiva Toras Chaim Toras Emes
305-944-5344 x222 (o)
305-494-2055 (cell)
aefri...@ytcteam.org


Ross Scroggs

unread,
Jul 17, 2018, 11:20:58 AM7/17/18
to google-ap...@googlegroups.com
Avrohom,

gam ou '/Students/Class of 2018' print users primaryemail | gam csv - gam user ~primaryEmail get drivefile query "'me' in owners" format microsoft targetfolder ~primaryEmail

I can change get drivefile to accept #user# #email# #username# in targetfolder as in other commands.

Ross


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


--

Avrohom Eliezer Friedman

unread,
Jul 17, 2018, 11:33:14 AM7/17/18
to google-ap...@googlegroups.com
Awesome!!! Anyway I can send this todrive?



-----
Avrohom Eliezer Friedman
IT Director

Yeshiva Toras Chaim Toras Emes
305-944-5344 x222 (o)
305-494-2055 (cell)
aefri...@ytcteam.org

Ross Scroggs

unread,
Jul 17, 2018, 11:41:44 AM7/17/18
to google-ap...@googlegroups.com
Avrohom,

Send what todrive?

Ross




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


--

Avrohom Eliezer Friedman

unread,
Jul 17, 2018, 11:50:15 AM7/17/18
to google-ap...@googlegroups.com
all those files - essentially - I'll have in my gam folder folders with all the usernames and inside is a backup of their drive



-----
Avrohom Eliezer Friedman
IT Director

Yeshiva Toras Chaim Toras Emes
305-944-5344 x222 (o)
305-494-2055 (cell)
aefri...@ytcteam.org

Avrohom Eliezer Friedman

unread,
Jul 17, 2018, 4:12:18 PM7/17/18
to google-ap...@googlegroups.com
FYI - 

Ross helped me out privately. The command that is the best for what I'm trying to do is

gam ou '/Students/Class of 2018' transfer drive aefri...@ytcteam.org targetfoldername 'Class of 2018' targetuserfoldername "#email#"

I first need to create a folder in my Drive called  Class of 2018. This puts a folder for each user and puts their docs in the folder
-----
Avrohom Eliezer Friedman
IT Director

Yeshiva Toras Chaim Toras Emes
305-944-5344 x222 (o)
305-494-2055 (cell)
aefri...@ytcteam.org

+KimNilsson

unread,
Jul 19, 2018, 10:26:55 AM7/19/18
to GAM for G Suite
Avrohom, so you were looking to get a full copy of the content from all of your students Drive into your own Drive?
No filtering, everything? May I ask for what reason? For the audit of a single user I could understand, but for everyone?

Ross, so the "transfer" command in this case is actually a copy and not really a transfer?

/Kim

Ross Scroggs

unread,
Jul 19, 2018, 10:36:14 AM7/19/18
to google-ap...@googlegroups.com
Kim,


It's basically a move and ownership change combined.

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.

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


--

+KimNilsson

unread,
Jul 19, 2018, 11:10:38 AM7/19/18
to GAM for G Suite
Thanks, Ross, that's what I thought.

Peter Smulders

unread,
Jul 20, 2018, 5:29:13 AM7/20/18
to GAM for G Suite
'Transfer' is analog to the option you get when you delete an account (i.e. to move various types of content to a new owner) and is meant for 'everything and the kitchen sink'. If you need a more granular approach (like dividing a disused account's stuff between multiple accounts) you might want to look into the 'drop folder' concept I recently posted about. --peter

Tom Vivian

unread,
Sep 17, 2022, 10:35:04 AM9/17/22
to GAM for Google Workspace
I am new to GAM & GAMADV but have it properly installed as I have been running various commands sucessfully.
When I try to run 
gam user us...@domain.com get drivefile query "'me' in owners" format microsoft
I get the following error message.
Download Failed: Only files with binary content can be downloaded. Use Export with Docs Editors files.

Any help much appreciated.
Thx, Tom.

On Friday, 20 July 2018 at 10:29:13 UTC+1 Peter Smulders wrote:
'Transfer' is analog to the option you get when you delete an account (i.e. to move various types of content to a new owner) and is meant for 'everything and the kitchen sink'. If you need a more granular approach (like dividing a disused account's stuff between multiple accounts) you might want to look into the 'drop folder' concept I recently posted about. --peter

Tatler: Prep school of the year 2019/20

Aysgarth School Trust Limited
Newton-Le-Willows | Bedale | North Yorkshire | DL8 1TF
Tel:  01677 450240
Follow us on Facebook | Instagram | Twitter

"...boy-friendly atmosphere where you can 'be your own man'." - click here to read the full Good Schools Guide review.

This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this email. Please notify the sender immediately by email if you have received this email by mistake and delete this email from your system. Email transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of email transmission. If verification is required please request a hard-copy version. 
Aysgarth School Trust Limited, Newton le Willows, Bedale, North Yorkshire, DL8 1TF.

Registered Charity No. 529538 (England)
Company Number: 898078
Registered Office: Aysgarth School Trust Limited, Newton le Willows, Bedale, North Yorkshire, DL8 1TF
Telephone - 01677 450240

Ross Scroggs

unread,
Sep 17, 2022, 11:07:27 AM9/17/22
to google-ap...@googlegroups.com
Tom,

It appears that you are trying to download your entire My Drive structure; GAM is the wrong tool for that purpose. 

Ross
----
Ross Scroggs



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

Peter Andrejko

unread,
Jun 30, 2023, 8:39:57 AM6/30/23
to GAM for Google Workspace
Hello I have a similar problem like  Tom Vivian
I'm trying to run a query to download concrete JPG file 

Query:

gam user user@domain get drivefile 12xc9SLiWz2HVVqaRTM83dS9PsdnKnyU format microsoft 

Result: 

User:  user@domain , Drive File: 202102021931191001__01.jpg, Download to: XXXX/Downloads/202102021931191001__01.jpg, Download Failed: Only files with binary content can be downloaded. Use Export with Docs Editors files.". Details: "[{'message': 'Only files with binary content can be downloaded. Use Export with Docs Editors files.', 'domain': 'global', 'reason': 'fileNotDownloadable', 'location': 'alt', 'locationType': 'parameter'}]

is there a way to download it with gam  ? without rclone

thanks


Dne sobota 17. září 2022 v 17:07:27 UTC+2 uživatel Ross Scroggs napsal:

Ross Scroggs

unread,
Jun 30, 2023, 10:09:14 AM6/30/23
to google-ap...@googlegroups.com
What does this show: 
gam user user@domain show fileinfo 12xc9SLiWz2HVVqaRTM83dS9PsdnKnyU fields name,mimetype

Ross
----
Ross Scroggs


Peter Andrejko

unread,
Jul 3, 2023, 9:44:33 AM7/3/23
to GAM for Google Workspace

Hello 

gam user cheriape show fileinfo 12xc9SLiWz2HVVqaRTM83dS9PsdnKnyU fields name,mimetype

return : 

 Drive Shortcut: 202102021931191001__01.jpg (12xc9SLiWz2HVVqaRTM83dS9PsdnKnyU)

    mimeType: application/vnd.google-apps.shortcut

    name: 202102021931191001__01.jpg


Dne pátek 30. června 2023 v 16:09:14 UTC+2 uživatel Ross Scroggs napsal:

Ross Scroggs

unread,
Jul 3, 2023, 11:14:32 AM7/3/23
to google-ap...@googlegroups.com
Peter,

You' re trying to download a shortcut, do the following to get the id of the actual file.
gam user cheriape show fileinfo 12xc9SLiWz2HVVqaRTM83dS9PsdnKnyU fields name,mimetype,shortcutdetails

Ross



--

Ross Scroggs

unread,
Jul 3, 2023, 12:54:29 PM7/3/23
to google-ap...@googlegroups.com
I'm updating the code to follow the shortcut and download the file it points to.

Ross
--

Peter Andrejko

unread,
Jul 17, 2023, 6:26:45 AM7/17/23
to GAM for Google Workspace
Thank you very much, its works.
Peter A.

Dne pondělí 3. července 2023 v 18:54:29 UTC+2 uživatel Ross Scroggs napsal:
Reply all
Reply to author
Forward
0 new messages