locked
How do you apply a new or edited quota to all sites in a site collection? RRS feed

  • Question

  • Hi,

    I have uploaded hundreds of thousands of files to many sites in a single site collection and now i have many more files to upload but sharepoint has hit some quota - i have increased in in central admin.

    I have read: " A member of the Farm Administrators group must manually apply all modified values to all existing sites that use the quota template."

    How do you do this?

    Thursday, March 14, 2019 5:20 PM

Answers

  • Here are the scripts below

    [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
    [Void]System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Administration")
     
    function global:Get-SPSite($url)
     {
        return new-Object Microsoft.SharePoint.SPSite($url)
     }
     
    $contentService =[Microsoft.SharePoint.Administration.SPWebService]::ContentService
     
    $QuotaTemplate = $contentService.QuotaTemplates["Gold - 1 GB"]
    $site = Get-SPSite "http://sharepoint.company.com/"
    $site.quota=$QuotaTemplate
    
    
    


    Please remember to click Mark as Answer on the answer if it helps you

    http://www.sharepointdiary.com/2013/08/change-site-collection-quota-using-powershell.html#ixzz5iAeMpOUI

    Thursday, March 14, 2019 6:07 PM
  • Hi, xyz2012,

    According to your description, it appears to me that you only change the quota template. To enlarge the storage quota, go to CA>application management>configure quotas and locks. Select the site collection you want to change, and change the size to what you want. You can check the change immediately in the site collection level setting>storage metrics.

    If I misunderstand anything, please tell the detailed steps you have done and the final goal. Screenshots will be useful.

    Best Regards

    Jerry Xu


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    • Marked as answer by xyz2012 Friday, March 15, 2019 1:58 PM
    Friday, March 15, 2019 7:37 AM
  • Awesome! I did not use your script - I used this one below which also worked but only after i created a new template with the correct quota and selected this against the web app in Central Admin...


    $OldTemplateName = "Individual Quota"
    $NewTemplateName = "New Quota"
    $WebApplicationUrl = "https://dcm/"
    $contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
    $quotaTemplate = $contentService.QuotaTemplates[$OldTemplateName]
    $replaceQuotaTemplate = $contentService.QuotaTemplates[$NewTemplateName]
    $webApplication = Get-SPWebApplication $WebApplicationUrl
    $webApplication.Sites | ForEach-Object { try { if ($_.Quota.QuotaID -eq       
    $quotaTemplate.QuotaID) { $_.Quota = $replaceQuotaTemplate } } finally { $_.Dispose();}}

    THIS WAS THEN RUN TO CHECK THE NEW QUOTA HAD BEEN APPLIED..

    Get-SPSite | Select-Object Url,  @{n="SizeInMB";e={(($_.Usage).Storage)/1MB}},
    @{n="MaxSizeInMB";e={(($_.Quota).StorageMaximumLevel)/1MB }},
    @{n="WarningSizeInMB";e={(($_.Quota).StorageWarningLevel)/1MB }} | 
    Sort-Object -Descending -Property "SizeInMB" | FT


    • Marked as answer by xyz2012 Friday, March 15, 2019 2:02 PM
    • Edited by xyz2012 Friday, March 15, 2019 2:03 PM
    Friday, March 15, 2019 2:01 PM

All replies

  • Here are the scripts below

    [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
    [Void]System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Administration")
     
    function global:Get-SPSite($url)
     {
        return new-Object Microsoft.SharePoint.SPSite($url)
     }
     
    $contentService =[Microsoft.SharePoint.Administration.SPWebService]::ContentService
     
    $QuotaTemplate = $contentService.QuotaTemplates["Gold - 1 GB"]
    $site = Get-SPSite "http://sharepoint.company.com/"
    $site.quota=$QuotaTemplate
    
    
    


    Please remember to click Mark as Answer on the answer if it helps you

    http://www.sharepointdiary.com/2013/08/change-site-collection-quota-using-powershell.html#ixzz5iAeMpOUI

    Thursday, March 14, 2019 6:07 PM
  • Hi, xyz2012,

    According to your description, it appears to me that you only change the quota template. To enlarge the storage quota, go to CA>application management>configure quotas and locks. Select the site collection you want to change, and change the size to what you want. You can check the change immediately in the site collection level setting>storage metrics.

    If I misunderstand anything, please tell the detailed steps you have done and the final goal. Screenshots will be useful.

    Best Regards

    Jerry Xu


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    • Marked as answer by xyz2012 Friday, March 15, 2019 1:58 PM
    Friday, March 15, 2019 7:37 AM
  • Awesome! I did not use your script - I used this one below which also worked but only after i created a new template with the correct quota and selected this against the web app in Central Admin...


    $OldTemplateName = "Individual Quota"
    $NewTemplateName = "New Quota"
    $WebApplicationUrl = "https://dcm/"
    $contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
    $quotaTemplate = $contentService.QuotaTemplates[$OldTemplateName]
    $replaceQuotaTemplate = $contentService.QuotaTemplates[$NewTemplateName]
    $webApplication = Get-SPWebApplication $WebApplicationUrl
    $webApplication.Sites | ForEach-Object { try { if ($_.Quota.QuotaID -eq       
    $quotaTemplate.QuotaID) { $_.Quota = $replaceQuotaTemplate } } finally { $_.Dispose();}}

    THIS WAS THEN RUN TO CHECK THE NEW QUOTA HAD BEEN APPLIED..

    Get-SPSite | Select-Object Url,  @{n="SizeInMB";e={(($_.Usage).Storage)/1MB}},
    @{n="MaxSizeInMB";e={(($_.Quota).StorageMaximumLevel)/1MB }},
    @{n="WarningSizeInMB";e={(($_.Quota).StorageWarningLevel)/1MB }} | 
    Sort-Object -Descending -Property "SizeInMB" | FT


    • Marked as answer by xyz2012 Friday, March 15, 2019 2:02 PM
    • Edited by xyz2012 Friday, March 15, 2019 2:03 PM
    Friday, March 15, 2019 2:01 PM