Quantcast
Channel: SharePoint Diary
Viewing all articles
Browse latest Browse all 1058

Create SharePoint Quota Templates using PowerShell

$
0
0
SharePoint quota templates enables us to keep the site collections growth in control. It defines the maximum amount of data stored in a site collection and prevent from disk fillings!

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 2010
Creating new quota template in SharePoint 2010 is relatively simpler! Go to:
  • Central Administration >> Application Management
  • Click on "Specify quota templates" under "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 of storage limit, warning limits of the quota template.
  • Optionally, You can specify the sandboxed code limits
  • Click "OK" to complete creation of new quota template sharepoint 2010 create quota template
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
     $contentService.QuotaTemplates.Add($quotaTemplate)
     $contentService.Update()
            #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: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spquotatemplatecollection.add.aspx

Viewing all articles
Browse latest Browse all 1058

Trending Articles