Shared Drive link commands

80 views
Skip to first unread message

Bart

unread,
Mar 28, 2024, 5:47:53 PM3/28/24
to GAM for Google Workspace
Hey All,

I'm currently trying to audit a single folder in a shared drive to find if any files allow anyone in the domain to access via the link.  Once I've identified those files I would like to change that link permission to restricted. 

I've been looking through past similar question and cannot find one thats specific to shared drives.  Would someone be able to help me out with this or is this even possible?

Thanks
Bart

Maj Marshall Giguere

unread,
Mar 28, 2024, 6:25:20 PM3/28/24
to google-ap...@googlegroups.com
Bart;

I assume your are using advanced gam?  You will need a user that has organizer or content manager permission on the target drive.

> gam redirect csv ./FilesSharedDomain.csv user <organizer> print filelist select shareddrive "<drive name>" shareddrivefilename "<folder name>" fields id,name,mimetype,permissions filepath oneitemperrow pmfilter pm type domain em

That should get you what you want if I've sussed it correctly.

-Marsh

--
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/e7a94d01-83f0-4454-8fb7-8169aa44871cn%40googlegroups.com.

Ross Scroggs

unread,
Mar 28, 2024, 6:41:10 PM3/28/24
to google-ap...@googlegroups.com
Edit Marsh's solution to only show non-inherited ACLs.
If you happen to have the folder ID you can replace
select shareddrive "<drive name>" shareddrivefilename "<folder name>"
with
select <folder ID>

# Get the non-inherited domain shares
gam redirect csv ./FilesSharedDomain.csv user <organizer> print filelist select shareddrive "<drive name>" shareddrivefilename "<folder name>" fields id,name,mimetype,basicpermissions filepath oneitemperrow pmfilter pm type domain inherited false em

# Look at FilesSharedDomain.csv and verify that it is what you want

# Delete the domain shares
gam redirect stdout ./DeleteFilesSharedDomain.txt multiprocess redirect stderr stdout csv FilesSharedDomain.csv gam user "~Owner" delete drivefileacl "~id" "id:~~permission.id~~"

Ross
----
Ross Scroggs



Reply all
Reply to author
Forward
Message has been deleted
0 new messages