Entra / Microsoft 365 · SharePoint & OneDrive
Report OneDrive storage usage
Report OneDrive for Business storage usage across the tenant using SharePoint Online PowerShell.
Connect & set up
Run these once per session. All scopes are read-only unless the script makes changes.
Connect-SPOService -Url $AdminUrl
Run it
The main script. Copy it, or download the .ps1 and run it from your console.
$ODFBSites = Get-SPOSite -IncludePersonalSite $True -Limit All -Filter "Url -like '-my.sharepoint.com/personal/'" | Select Owner, Title, URL, StorageQuota, StorageUsageCurrent | Sort StorageUsageCurrent -Desc$TotalODFBGBUsed = [Math]::Round(($ODFBSites.StorageUsageCurrent | Measure-Object -Sum).Sum /1024,2)$Report = @()ForEach ($Site in $ODFBSites) {$ReportLine = [PSCustomObject][Ordered]@{Owner = $Site.TitleEmail = $Site.OwnerURL = $Site.URLQuotaGB = [Math]::Round($Site.StorageQuota/1024,2)UsedGB = [Math]::Round($Site.StorageUsageCurrent/1024,4) }$Report += $ReportLine }$Report | Export-CSV -NoTypeInformation c:\temp\OneDriveSiteConsumption.CSVWrite-Host "Current OneDrive for Business storage consumption:" $TotalODFBGBUsed " Report is in C:\temp\OneDriveSiteConsumption.CSV"
Attribution
Author
Office365itpros