Using Quota Template to manage site collection storage limits (Power Shell, SharePoint 2010)


In this article I am showing you how to set limit for SharePoint 2010 site collection using Quota Template. Here I am using Power Shell to define Quota Template.

A quota Templates defines the storage limit for the maximum amount of data that can be stored in a site collection.

When the site collection reaches the Quota template defined by Administrato, it triggers an e-mail alert to the site collection administrator. Quotas can be saved as quota templates so that we can apply them to any site collection in a SharePoint farm.

Create Quota Template

1. On the Start menu, click All Programs.

2. Click Microsoft SharePoint 2010 Products.

3. Click SharePoint 2010 Management Shell.

4. At the Windows Power Shell command prompt type the following command:

pic1.gif

5. You will get a Power shell command prompt like below

pic2.gif

The Syntax to create Quota Template is as shown

$Customquota = New-Object Microsoft.SharePoint.Administration.SPQuotaTemplate
$Customquota.Name = "ProjectQuota"
$Customquota.StorageMaximumLevel = 1048576
$Customquota.StorageWarningLevel = 524288
$Service = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$Service.QuotaTemplates.Add($Customquota)
$Service.Update()

  • Name - You have to give the Quota Template name as string value.

  • StorageMaximumLevel –Is the maximum size for your site collection(In Bytes).

  • StorageWarningLevel-Will give email message if the Quota template reaches the value specified in this column(In Bytes)

Please find the command in action

pic3.gif

To change the quota template for a site collection by using Windows Power Shell.

The Syntax Change the Quota Template for a site collection.

Set-SPSite -Identity "Site URL" -QuotaTemplate "Template Name"

  • Site URL- is the URL of the site collection whose quota template you want to change.

  • Template Name -is the name or GUID of the replacement template.