Search This Blog

Wednesday, July 5, 2017

Create SharePoint Site Quote Template Using Powershell

Create SharePoint Site Quote Template Using Powershell 

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
function CreateQuotaTemplate ($QuotaName, $MaxLevelMB, $WarnLevelMB)
 {
 $quotaTemplate = New-Object Microsoft.SharePoint.Administration.SPQuotaTemplate
 $quotaTemplate.Name = $QuotaName
 $quotaTemplate.StorageMaximumLevel = ($MaxLevelMB*1024)*1024
 $quotaTemplate.StorageWarningLevel = ($WarnLevelMB*1024)*1024
 $contentService =
[Microsoft.SharePoint.Administration.SPWebService]::ContentService
 $contentService.QuotaTemplates.Add($quotaTemplate)
 $contentService.Update()
 Write-Host "New Quota Template: $($QuotaName) has been added!"
 }
 CreateQuotaTemplate –QuotaName "10GB_Quota" –MaxLevelMB 10000 –WarnLevelMB 9500
 CreateQuotaTemplate –QuotaName "25GB_Quota" –MaxLevelMB 25000 –WarnLevelMB 20000
 CreateQuotaTemplate –QuotaName "50GB_Quota" –MaxLevelMB 50000 –WarnLevelMB 45000
 CreateQuotaTemplate –QuotaName "100GB_Quota" –MaxLevelMB 100000 –WarnLevelMB 95000
 CreateQuotaTemplate –QuotaName " Personal Site 500MB_Quota" –MaxLevelMB 500 –

WarnLevelMB 400

No comments:

Post a Comment