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...