Tuesday, August 6, 2013

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.

Solution: 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 an another script to generate 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) }

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:


  1. 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

    1. Add yourself under User Policy with FULL control for MySite Web Application!


Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...