Create SharePoint Quota Templates using PowerShell

SharePoint quota templates enable us to keep the site collections growth in control. It defines the maximum amount of data stored in a site collection and prevents disk fillings! Quota template makes it easier to govern site collections growth by assigning a pre-defined sizing template to them, rather than assigning individual quotas to each site collections on the farm. Quota templates set how much storage space a site collection can occupy.

Quota templates offer two levels: Warning Level and Maximum Storage Level.Once the site collection reaches warning level, SharePoint triggers an Email to site collection administrators and further addition to site is possible until it reaches to Maximum storage level.

How to create a New Quota Template in SharePoint?

Creating a new quota template in SharePoint is a relatively simpler task! Go to:

  • Central Administration >> Application Management
  • Click on “Specify quota templates” under the “Site Collections” group
  • On the quota templates page click on “Create a new template” >> Give a Name to your new Quota Template
  • Specify the maximum storage limit, warning limits of the quota template. Optionally, You can specify the sandboxed code limits
  • Click “OK” to complete the creation of a new quota template sharepoint create quota template powershell

PowerShell Script to Create New Quota Template in SharePoint:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Function to Create New Quota Template
function CreateQuotaTemplate ($QuotaName, $MaxLevelMB, $WarnLevelMB)
     $quotaTemplate = New-Object Microsoft.SharePoint.Administration.SPQuotaTemplate
     #Set Quota Name
     $quotaTemplate.Name = $QuotaName
     #Set Maximum & Warning Levels
     $quotaTemplate.StorageMaximumLevel = ($MaxLevelMB*1024)*1024
     $quotaTemplate.StorageWarningLevel = ($WarnLevelMB*1024)*1024
     #Add the Quota Template
     $contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
     #Print a Success message
     Write-Host "New Quota Template: $($QuotaName) has been added!"

#Call the function to Create Quota
CreateQuotaTemplate -QuotaName "Standard" -MaxLevelMB 250 -WarnLevelMB 200

To Create SharePoint quota template programmatically using C#, Refer:

Update an Existing Quota Template using PowerShell:

To update an existing quota template, use this PowerShell script.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Target quota Name to update
$QuotaName = "Standard"
$ContentService  =[Microsoft.SharePoint.Administration.SPWebService]::ContentService

#Get the Quota Template
$QuotaTemplate = $ContentService.QuotaTemplates[$QuotaName]

#Rename the Quota Template
$QuotaTemplate.Name = "Standard Plus"

#Increase the Maximum size from 250MB to 350MB
$QuotaTemplate.StorageMaximumLevel = (350*1024)*1024

Write-Host "Quota Template has been updated!" -f Green

PowerShell to Delete a Quota Template from SharePoint:

#Target quota Name to delete
$QuotaName = "Standard Plus"
$ContentService  =[Microsoft.SharePoint.Administration.SPWebService]::ContentService

#Delete the Quota Template

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

Leave a Reply

Your email address will not be published. Required fields are marked *