Report · 2 tools
OneDrive storage usage per user
Summary
Builds a OneDrive storage report for capacity planning and migration sizing: owner, storage used, file count and last activity. Two approaches: the SharePoint admin view of personal sites, and the Microsoft Graph usage report.
Implementation
Choose your tool. Your choice is remembered on other samples.
Connect-SPOService -Url "https://<tenant>-admin.sharepoint.com"
Get-SPOSite -IncludePersonalSite $true -Limit All -Filter "Url -like '-my.sharepoint.com/personal/'" |
Select-Object Owner, Url, @{ n = "StorageGB"; e = { [math]::Round($_.StorageUsageCurrent / 1024, 2) } }, LastContentModifiedDate |
Sort-Object StorageGB -Descending |
Export-Csv .\onedrive-storage.csv -NoTypeInformationConnect-MgGraph -Scopes Reports.Read.All -NoWelcome
# Last 30 days. Names may be concealed if report privacy is on in the admin center.
Get-MgReportOneDriveUsageAccountDetail -Period D30 -OutFile .\onedrive-usage-raw.csv
Import-Csv .\onedrive-usage-raw.csv |
Select-Object "Owner Principal Name", "File Count", "Active File Count",
@{ n = "StorageGB"; e = { [math]::Round([double]$_."Storage Used (Byte)" / 1GB, 2) } }, "Last Activity Date" |
Sort-Object StorageGB -Descending |
Export-Csv .\onedrive-storage.csv -NoTypeInformationPrerequisites
- SharePoint Administrator, or Reports Reader for the Graph report
- Graph scope Reports.Read.All
Output
CSV sorted by storage used, largest first.
Contributors
| Author | Role |
|---|---|
| Priyanshu Upadhyay | Solution Architect, Microsoft 365 and Azure |
InnovaticT