Transfer Data to Manager

110 views
Skip to first unread message

J.Admin

unread,
Nov 8, 2023, 5:05:39 PM11/8/23
to GAM for Google Workspace
Hi folks! Wondering what would be the set of steps for a script or a command to transfer a users drive data automatically to their manager if the "manager's email" field in Google is populated for a user without having to enter the manager's email?

Essentially having the "<New Owner Email> " below auto populated?

gam user <User Email> transfer drive <New Owner Email> 

Thank you! :)

Maj Marshall Giguere

unread,
Nov 8, 2023, 5:45:38 PM11/8/23
to google-ap...@googlegroups.com
AFAIK the answer is no.  You will need to examine the source owners account and extract the manager's email and then insert it into the transfer command.  Obviously if the manager's email field isn't populated then you're on your own.

I can think of ways to script something like this, but it's still a multi-step process.
1. find the users whose drives you want to transfer
2. extract the manager's email (if it exists) to a csv file with two columns: primarEmail and manager_email. 
3. use the previous csv to feed the gam transfer command.

If you're using advanced gam here are some suggested readings:



Maj Marshall E Giguere

NH Wing Director of IT

Civil Air Patrol, U.S. Air Force Auxiliary

GoCivilAirPatrol.com

nhwg.cap.gov

Volunteers serving America's communities, saving lives, and shaping futures.


--
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/0a3e0ca7-7c52-4043-a5c1-3c587bacd359n%40googlegroups.com.

J.Admin

unread,
Nov 8, 2023, 6:32:57 PM11/8/23
to GAM for Google Workspace
Thanks Maj! I was thinking the same (exporting to a csv) and was hoping there was an easier way. Doing the csv route for now! :D

J.Admin

unread,
Nov 10, 2023, 4:42:44 PM11/10/23
to GAM for Google Workspace
For what its worth, if anyone comes later and wants to know, found a way to do so if running a bash script. You can turn it into a variably by:

managerEmail="$gam info user $userEmail | awk '/type: manager/ {getline; print $2}'"

where "gam" is the path to the bin and "userEmail" is the users email. The command later then looks like

$gam user "$userEmail" transfer drive "$managerEmail"

¯\_(ツ)_/¯ 
Reply all
Reply to author
Forward
0 new messages