Thursday, August 1, 2013

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

sharepoint 2010 personal site quota template
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.
Your changes could not be saved because this SharePoint Web site has exceeded the storage quota limit.
Went to Central Administration, Verified again that Site collections has enough space to accommodate new items.
sharepoint 2010 quota template powershell
In short: Even if you increase a quota template's limits, it won't reflect on site collections which are already using that quota!
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 which are using the particular quota still be showing old quota values. So, the fix is: Switch the Quota template of the site collection to some thing 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 Change:
Lets 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 = ""
        $MySiteQuota = "Personal Site"
 $TempQuota = "Starter"
 Start-SPAssignment -Global
 #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)!"
 Stop-SPAssignment -Global

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:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...