The G Suite offboarding features leave much to be desired, and IT teams will often end up bringing in services such as BetterCloud to automate the process. It is rare that GAM cannot solve a G Suite problem, so here is a GAM script that takes care of archiving a user’s email and/or Google Drive files, which would be run after the 1 or 3 month keep account active for forwarding/email delegation/OOO greeting period. In its current form it must be run from CLI, however a batch-run script is also included for convenience.
There does not seem to be any way to save the Vault export directly to Google Drive, so this workflow downloads the files and re-upload them programatically.
The script runs on the following basis:
1. Creates a Vault export
2. Waits for export to finish
3. Downloads the export files
4. Compresses the downloaded files
5. Uploads the archive to a specified Google Drive folder or shared drive
6. Deletes the local temporary files
7. Optionally deletes the user in G Suite
Great script!
I forked it and added a process to automatically delete the Vault export after successfully archiving, and also adjusted all references of ‘G Suite’ to ‘Google Workspace’. Feel free to update your script if you want.
https://gist.github.com/NoSubstitute/b567a544bad6064bb3c8e4fb8b4ca299
As I mostly use GAMADV-XTD3 I added a reference to that in the notes, so people don’t freak out when it doesn’t work.
Forked the batch script too, and touched it a little.
https://gist.github.com/NoSubstitute/6ddf2c38dc85f8e34f6754d88a395971