Managing files across multiple SharePoint sites in Microsoft 365 can be challenging, especially when you need visibility into all files for compliance, auditing, or migration purposes. To simplify this process, I’ve created a PowerShell script that will list all SharePoint site files. This post will explain what the script does, why it’s useful, and how you can deploy it.
List All SharePoint Site Files
The script connects to your Microsoft 365 tenant and retrieves a comprehensive list of files from specified SharePoint sites. Key features include:
- Lists every file within document libraries across specified sites.
- Outputs details such as file name, URL, size, and last modified date.
- Exports the data to a CSV file for easy reporting and analysis.
This approach saves hours compared to manually checking each site and library.
Why Would You Need This Script?
There are several scenarios where this script is invaluable:
- Compliance and Auditing: Ensure sensitive files are properly stored and monitored.
- Migration Planning: Identify large files or unused content before moving data.
- Storage Analysis: Understand how storage is being used across your tenant.
- Governance: Detect orphaned files or libraries that need cleanup.
Ready to try it out?
Head on over to GitHub to get the script, directions on using the script and more: PowerShell-for-Microsoft-365/ListAllSharePointSiteFiles.
This solution uses PnP PowerShell – head over to that site to learn more about the module!
If you have thoughts on ways of improving the script, please let me know!
