SharePoint Site Collection Storage Size – Quota Usage Report using PowerShell

Requirement: Wanted to get a quick storage quota report on SharePoint sites on their allocation vs used space metrics to find out underutilized sites.

PowerShell script to get SharePoint site quota report

If you want to get used storage space for a particular site collection, use:

Get-SPSite https://site-collection=url | select @{label="Size in MB";Expression={$_.usage.storage/1MB}}

To get storage data for all site collections, use:

Get-SPSite | Select Url, @{Label="Size";Expression={$_.usage.Storage/1MB}} | Sort-Object -Descending -Property "Size"
sharepoint powershell get site collection size

Get Site collection Storage assigned vs used for all site collections:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

Get-SPSite | Select URL,`
@{Name="Site Owner"; Expression={$_.Owner.Email}},`
@{Name="Quota Assigned"; Expression={"{0:N2} MB" -f ($_.Quota.StorageMaximumLevel/1MB)} } ,`
@{Name="Storage Used"; Expression={"{0:N2} MB" -f ($_.Usage.Storage/1MB)}},`
@{Name="Percentage Used"; Expression={"{0:P2}" -f (   ($_.Usage.Storage/1MB) / ($_.Quota.StorageMaximumLevel/1MB ))}}`
| Out-GridView -Title " Quota Report"

Report Output:

SharePoint Site Collection Quota Usage Report

Note that the “Infinity” has occurred on sites with No quota assigned!

Here is another script to generate a Storage Quota report:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Get all available Quota Templates
$QuotaTemplates = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.QuotaTemplates 
$QuotaHash=@{} #Hash Array to Hold: Quota ID & Name
$QuotaTemplates | ForEach-Object { $QuotaHash.Add($_.QuotaID, $_.Name) } 

#Get All Site collections Quota
Get-SPWebApplication | Get-SPSite -Limit "All" |  ForEach-Object { Write-host $_.RootWeb.URL". Quota Assigned : "  $QuotaHash.Get_Item($_.Quota.QuotaID) }

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

4 thoughts on “SharePoint Site Collection Storage Size – Quota Usage Report using PowerShell

  • your blogs, especially powershell scripts are very useful & come in handy at several occasions. keep up the good work..Many thanks 🙂

    Reply
  • Hi,
    Thanks for this script! It helped me to pull the data quickly.

    Regards,
    Rustam Shaikh

    Reply
  • Hi and thank you for your great scripts. Really helpful.
    I have tried to use the above one but I have a problem – even though I have farm administrator rights, for all users MySites I always get 0 storage used. For my own MySite and other site-collections where I am owner I get the correct storage size, but for the users MySites. Is there a way to correct this behavior?
    Thank you very much,
    Marian Vulpe

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *