Google Workspace / GSuite with GAM – Extract all Drive files shared externally

This is a useful command for extracting all files shared with at least one external user in Google Drive.

I recommend running this command regularly to keep an eye on data exfiltration and improper sharing outside the company.

gam all users show filelist fields id,name,owners,permissions,alternatelink filepath pm notdomain <YOUR DOMAIN HERE> em pm type anyone em pmm or todrive