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 http://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 
[email protected]{} #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 is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

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

  • March 30, 2020 at 8:59 PM

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

    Reply
  • May 8, 2019 at 3:47 AM

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

    Regards,
    Rustam Shaikh

    Reply
  • February 10, 2015 at 5:48 PM

    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