Looking to unshare all My Drive items of suspended users

75 views
Skip to first unread message

Alexander Grutza (Alex)

unread,
Apr 14, 2025, 4:43:26 PM4/14/25
to GAM for Google Workspace
I found something similar but it was in Python and didn't convert well to powershell. 

We're looking to unshare all My Drive files from suspended users and after an amount of time delete the user. 

When a user is terminated, we suspend their account. That doesn't do anything with sharing. So when we delete the account we get notified of files missing, generally after 20 days and not able to be recovered.

So we're looking for the best way to unshare all My Drive files of these users.

  • I have 
  • gam user <username> show fileinfo root id returnidonly 
  • which outputs the fileid of the my drive of the particular user
  • but i don't know where to go from there to get the list of all files in the My Drive that are shared and unshare them.. 
  • or better yet, just unshare everything (regardless of permission) from someone's my drive
  • Google AI isn't much help in formulating a command...

Ross Scroggs

unread,
Apr 14, 2025, 5:15:44 PM4/14/25
to google-ap...@googlegroups.com
Send me a private Meet/Zoom invitation and I'll help.

Start here: get list of shared file
gam user us...@domain.com print filelist fields id,name,mimetype,basicpermissions pm not role owner em pmfilter oneitemperrow

Ross
----
Ross Scroggs



--
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 visit https://groups.google.com/d/msgid/google-apps-manager/029a540b-9c5f-4cbf-b6a0-83a9e76f5ddan%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages