Create Shared Drives & Assign Managers in Bulk

565 views
Skip to first unread message

David Walton

unread,
Nov 14, 2022, 6:15:38 PM11/14/22
to GAM for Google Workspace
Hi folks,

We have a form that users are submitting to request Shared Drives.

From that form, I have a .csv with columns for requesting user and the shared drive's name.

Is there a way to create shared drives in bulk and assign the listed user as a manager?

FWIW, I wasn't even able to do this with a single user, much less in bulk.

I tried using "gam user <User Email Address> create teamdrive "<Shared Drive Name>" adminmanagedrestrictions true asadmin" but this only works if the user has permissions to create shared drives (which we don't assign to our users).

Presumably I could use my admin account to create these shared drives, but then I'd need a way to easily output their Drive IDs, and keep those Drive IDs associated with the user who submitted the request who needs to be added as a manager.

Any ideas?


--

James SEYMOUR

unread,
Nov 14, 2022, 6:32:57 PM11/14/22
to google-ap...@googlegroups.com
Hi David,

From my notes I have this for a single user.

gam user <User Email Address> create teamdrive "<Shared Drive Name>" adminmanagedrestrictions true asadmin

From this page https://github.com/taers232c/GAMADV-XTD3/wiki/Shared-Drives#create-a-shared-drive it states that the user creating the Shared Drive is given the role organiser.
 
You should be able to use this in a command for bulk creation, by adding gam csv gsheet <User Email Address> <File ID> <Sheet Name> to the start of the command. Where the FileID and the Sheet Name relate to your Google Form responses sheet.

Regards


James Seymour
Head of Systems and Communication
[t] +673.24.11.000  Ext 1203
[Time Zone] GMT +8 Hours


--
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/bd74bd95-241a-4938-91a5-a042a5b14cdbn%40googlegroups.com.

Jerudong International School
https://www.jerudonginternationalschool.com
Follow us on:
http://www.facebook.com/jisbruneidarussalam http://www.twitter.com/jisbrunei http://www.instagram.com/jisbrunei https://www.youtube.com/user/JISBrunei https://www.flickr.com/photos/133960569@N03/albums

David Walton

unread,
Nov 14, 2022, 6:43:44 PM11/14/22
to google-ap...@googlegroups.com
Thanks, James.

This is the command I was using (See my original email), but I think it requires the user to have permission to create shared drives. Since we don't enable that for all users, the command doesn't work.

I suppose I could first create a temporary group with shared drive management permission, put the requested users into the group, create the shared drives, then remove them from the group...



--

David Walton

Information Security Analyst

James SEYMOUR

unread,
Nov 14, 2022, 6:50:27 PM11/14/22
to google-ap...@googlegroups.com
Hi David,

Opps, sorry, I missed that. Have you tried just using gam user <User Email Address> create teamdrive "<Shared Drive Name>? Without the bit on the end. This just worked for me.

Regards


James Seymour
Head of Systems and Communication
[t] +673.24.11.000  Ext 1203
[Time Zone] GMT +8 Hours

James SEYMOUR

unread,
Nov 14, 2022, 7:00:54 PM11/14/22
to GAM for Google Workspace
Hi David,

What version of GAM are you using (gam version)? I just tested gam user <User Email Address> create teamdrive "<Shared Drive Name>" adminmanagedrestrictions true asadmin and it worked for me.

Cheers

James

David Walton

unread,
Nov 14, 2022, 7:09:09 PM11/14/22
to google-ap...@googlegroups.com
James, is the user you tested with able to create Shared Drives from their account?

James SEYMOUR

unread,
Nov 14, 2022, 7:27:30 PM11/14/22
to GAM for Google Workspace
Yes, gam user test...@domain.com create teamdrive "Test User Shared Drive" worked for a standard test teacher account.

Have you got the setting "Prevent users in Students from creating new shared drives" turned on for the OU/Group that the user is in? This might be affecting things, so that you need to create using a different account, add the user to the new Shared Drive and then remove the original creator account.

Ross Scroggs

unread,
Nov 15, 2022, 12:30:15 PM11/15/22
to google-ap...@googlegroups.com

--
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/bd74bd95-241a-4938-91a5-a042a5b14cdbn%40googlegroups.com.


--

David Walton

unread,
Nov 15, 2022, 1:29:09 PM11/15/22
to google-ap...@googlegroups.com
Yes Jason, that's indeed what I've been trying to say. Thanks for helping me clarify. We don't allow users in any OU outside of our admin OU to create shared drives, and it looks like that's likely my problem since I'm on the newest version of GAMADV.

So I assume there are two options:
  1. As Jason mentioned, I can create the shared drives with an admin account then add these users as managers.
  2. I could run a command to modify these user's permissions and then create the shared drives, and then change their user permissions back.
The main concern with #1 is keeping track of shared drive IDs once they're created. 

Ross Scroggs

unread,
Nov 15, 2022, 1:31:29 PM11/15/22
to google-ap...@googlegroups.com
David,

I made an update to Advanced GAM so you can do what you want in 1.

6.28.10


Added option `addcsvdata <FieldName> <String>` to `gam create shareddrive ... csv`. This adds

additional columns of data to the CSV file output. For example, you are building student Shared Drives

and want to add ACLs to them adding the students as organizers. By adding the student's primary email address

to the CSV output, it can be used in subsequent commands.

```

StudentSharedDrives.csv

primaryEmail,Name

b...@domain.com,Bob Jones

ma...@domain.com,Mary Smith

...


# Create the student Shared Drives

gam redirect stdout ./StudentSharedDrivesCreated.txt multiprocess redirect stderr stdout redirect csv ./StudentSharedDrivesCreated.csv multiprocess csv StudentSharedDrives.csv gam create shareddrive "~Name" csv addcsvdata primaryEmail \

"~primaryEmail"

# Add ACLs granting the students organizer access to their Shared Drives.

gam redirect stdout ./StudentSharedDrivesAccess.txt multiprocess redirect stderr stdout csv StudentSharedDrivesCreated.csv gam add drivefileacl "~id" user "~primaryEmail" role organizer

```


Ross




--

David Walton

unread,
Nov 15, 2022, 1:51:19 PM11/15/22
to google-ap...@googlegroups.com
Ross,

This is great! It did exactly what I was looking for.

As a note, my StudentSharedDrivesCreated.txt has ~900 errors. 

ERROR: Empty argument: Expected <Non-empty Name>
Help: Syntax in file /Users/davidw75/bin/gamadv-xtd3/GamCommands.txt
Help: Documentation is at https://github.com/taers232c/GAMADV-XTD3/wiki
Command: gam create shareddrive >>>""<<< csv addcsvdata primaryEmail ""


That said, I only needed to make about 20 shared drives (For now), and there were only that many lines in my original StudentSharedDrives.csv. Nonetheless, all 20 drives appeared in the StudentSharedDrivesCreated.csv, and they were each created properly with the correct users and permissions, so errors aside it did exactly what I was hoping to do.

Ross Scroggs

unread,
Nov 15, 2022, 1:59:56 PM11/15/22
to google-ap...@googlegroups.com
David,

Show your CSV file header row and first data row (change data for privacy but don't change format)

Send me a Meet/Zoom invitation.

Ross



--

Ross Scroggs

unread,
Nov 15, 2022, 2:14:22 PM11/15/22
to google-ap...@googlegroups.com
David,

It looks like the CSV file had ~900 rows with no data; make sure that the CSV file has only the 20 rows you want.

Ross



--
Reply all
Reply to author
Forward
0 new messages