Using "gam download export" But In a Task Scheduler Script

220 views
Skip to first unread message

Derek Ritchison

unread,
Jun 8, 2022, 4:24:41 PM6/8/22
to GAM for Google Workspace
Hey all- I'm hoping someone else out there might have experienced the same thing I've been experiencing for some time now. I have an offboarding automation script that Task Scheduler triggers to run every X minutes, basically it looks for inserts in a database and if the "termination time" is "now" it runs and does all the things. One of those things is using GAM to create a Vault export, ping every sixty seconds for the status of that export, and then running "gam download export" to download it once it is ready. But here's the thing:

When the script is triggered via Task Scheduler it takes forever. No... like, FOREVER. The download part seems fine, but the validation just hangs and hangs and hangs. When I watch the process it always stalls right here:

Verifying file hash is <insert hash here>...

Now, when I run the exact same offboarding script locally, or, rather, just NOT via Task Scheduler this does not happen. The entire gam download export command takes about as long as you'd expect depending on the size of the export.

I am at a loss. Any ideas whatsoever?

Ross Scroggs

unread,
Jun 8, 2022, 4:40:08 PM6/8/22
to google-ap...@googlegroups.com
Derek,

Add noverify to the end of your command; it turns off hash verification.
Does that make a difference?

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/de6721dc-fd86-40b2-96da-1ef5ad643975n%40googlegroups.com.


--

Derek Ritchison

unread,
Jun 8, 2022, 4:50:29 PM6/8/22
to GAM for Google Workspace
Would I add it as such, right after my "noexport" command?

gam download export "Email Exports" "$export_name" targetfolder "\\path-to-folder\IT\Email Archives\2022\$export_name" noextract noverify

Are there more useful commands out there that are not on the documentation? I did not see this at all.

I'm still kinda curious _why_ this would be the case --- Task Manager vs. manual in the shell --- but if this helps I'll be quite happy.

Ross Scroggs

unread,
Jun 8, 2022, 5:00:08 PM6/8/22
to google-ap...@googlegroups.com
Derek,

At the end is fine.


Ross



--

Derek Ritchison

unread,
Jun 8, 2022, 5:28:19 PM6/8/22
to GAM for Google Workspace
Nice. Thank you. So, that documentation uses "gam download vaultexport" so is it recommended that I update my command since I am running the most recent version of gam or are both compatible?

Ross Scroggs

unread,
Jun 8, 2022, 5:42:01 PM6/8/22
to google-ap...@googlegroups.com
Dere,

Standard GAM command:

gam download export <MatterItem> <ExportItem> [noverify] [noextract] [targetfolder <FilePath>]


Advanced GAM command has a few more options:

gam download vaultexport|export <MatterItem> <ExportItem>

        [targetfolder <FilePath>] [targetname <FileName>] [noverify] [noextract] [ziptostdout]

        [bucketmatchpattern <RegularExpression>] [objectmatchpattern <RegularExpression>]


Ross




--

Jay Lee

unread,
Jun 8, 2022, 6:48:49 PM6/8/22
to google-ap...@googlegroups.com
- file hash validation is by far the most CPU intensive thing GAM does on the large exports and will consume lots of CPU time.
- most task schedulers run commands at lower priority than if you ran the command from the command line.

So my guess is your task scheduler is running GAM at a low priority which causes the has verification to take awhile.

As Ross mentioned you can turn off verification or you can figure out if your task scheduler can run commands at normal priority.

Jay

--

Derek Ritchison

unread,
Jun 8, 2022, 6:50:23 PM6/8/22
to GAM for Google Workspace
Jay- That is very helpful and great to know. Thank you for responding with what is likely the exact cause here!
Reply all
Reply to author
Forward
0 new messages