Changing Quota Templates Does Not Apply to Existing Site Collections

Post date: Mar 04, 2014 9:48:20 PM

I found that after increasing our default Quota Template for Mysites from 100MB to 500MB, users were still limited to the 100MB limit. Basically, a site collection "copies" the quota information during creation. Simply updating the quota template in Central Admin appears to update the site collection but actually does not.

Well, how do we update? There is a pretty simply answer to this; we reapply the quota template to the site collection. You can do this in CA by selecting a different template, saving the record, then update the site collection again back to the desired template and saving again. Bravo, your site collection now reflects the updated template.

Uh Oh, but I have thousands of site collections, I have to do this for every one? Short answer is yes; but, instead of doing this manually, lets use PowerShell to do it for us? The following function can be used to update all site collections of a given web application from using one quota template to another. If you simply updated the existing template, set the same template name for the old template and the new template.

function Update-SiteQuotaTemplate

{

Param

(

[parameter(Mandatory=$true)][string]$WebApplicationUrl,

[parameter(Mandatory=$true)][string]$OldQuotaTemplate,

[parameter(Mandatory=$true)][string]$NewQuotaTemplate

)

$contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService

$currentQuotaTemplate = $contentService.QuotaTemplates[$OldQuotaTemplate]

$replacementQuotaTemplate = $contentService.QuotaTemplates[$NewQuotaTemplate]

$webApplication = Get-SPWebApplication $WebApplicationUrl

$siteCollections = Get-SPSite -WebApplication $webApplication -Limit ALL

ForEach ($siteCollection in $siteCollections) {

try

{

if ($siteCollection.Quota.QuotaID -eq $currentQuotaTemplate.QuotaID) {

$siteCollection.Quota = $replacementQuotaTemplate

write-host "Updated Quota for Site " $siteCollection.Url

}

}

catch

{

write-host "The script has stopped because there has been an error."

}

finally

{

$siteCollection.Dispose();

}

}

}

Example call to this function where the template name did not change but the template needs to be reapplied.

Update-SiteQuotaTemplate -WebApplicationUrl "http://mysites.domain.com" -OldQuotaTemplate "Personal Sites" -NewQuotaTemplate "Personal Sites"