Apply SharePoint Quota Template Changes to Existing Sites
Problem Scenario:
End-users actively started using their “My Sites” and most of their My sites reached the site collection storage quota limit of 100MB! Gradually started receiving many requests to increase storage limits.
Initially, My site web application assigned with a “Personal” quota template which offers 100MB of disk space. After a while, we decided to increase my site storage quota limit to 250MB. So, went to Central Administration >> Application Management >> Specify Quota Templates >> Selected “Personal” Quota template and set that storage limit to 250MB.
That’s enough! This should fix the problem, isn’t it? Unfortunately NO! Users still receiving “Your changes could not be saved because this SharePoint Web site has exceeded the storage quota limit.” error while trying to upload a file or add new item to their SharePoint site.
Went to Central Administration, Verified again that Site collections has enough space to accommodate new items.
Fix:Â
Updating an existing SharePoint site quota template’s quota limits will not automatically increase the quota limits for the site collections which are already using that particular quota. Site collections that are using the particular quota still be showing old quota values. So, the fix is: Switch the Quota template of the site collection to something else and then switch it back to its original quota. Here is how: Go to
- Central Administration >> Application Management
- Click on “Configure Quotas and locks” under site collections group
- Change the site collection’s quota template to a different quota template (In my case its “Starter”). Click OK to save changes.
- Now, go back to Configure Quotas and locks and specify the old template (“Personal” in my case!) again. Click “OK” to save the changes.
That’s all! Problem solved? Yes, kind of! but are we going to do the same for our 100+ site collections? May be, depends on your time! but sounds like a bad idea!! So, Lets use PowerShell to automate this.
PowerShell Script to Apply Quota Changes:
Let’s use PowerShell to apply SharePoint 2010 quota template changes.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Define the parameter values: My Site Web App URL, Quota Template Names
$WebAppURL = "https://mysite.crescent.com/"
$MySiteQuota = "Personal Site"
$TempQuota = "Starter"
#Get the Quota Templates
$contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$MySiteQuotaTemplate = $contentService.QuotaTemplates[$MySiteQuota]
$TempQuotaTemplate = $contentService.QuotaTemplates[$TempQuota]
#Get all site collections
$Sites = Get-SPWebApplication $WebAppURL | Get-SPSite -Limit All
#Loop through all sites and Swap the Quota Templates
foreach($site in $Sites)
{
if($site.Quota.QuotaID -eq $MySiteQuotaTemplate.QuotaID)
{
#Set new Quota Template
$site.Quota = $TempQuotaTemplate
#Revert to Original Quota Template
$site.Quota = $MySiteQuotaTemplate
#Print a message
Write-host "Quota changes applied to : $($site.RootWeb.URL)!"
}
}