Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This article demonstrates a PowerShell Script to create, update, delete and assign site Quota template.
The Script works for both SharePoint 2010 and SharePoint 2013.
Create a new Quota template
01.$NewQTemp = New-Object Microsoft.SharePoint.Administration.SPQuotaTemplate
02. $newQTemp.Name = "Quota Temp1?
03. $newQtemp.StorageMaximumLevel = 104857600
04. $newQtemp.StorageWarningLevel = 94371840
05. $newQtemp.UserCodeMaximumLevel = 300
06. $newQtemp.UserCodeWarningLevel = 300
07. $Q =[Microsoft.SharePoint.Administration.SPWebService]::ContentService
08. $Q.QuotaTemplates.Add($newQtemp)
09. $Q.Update()
Note: Value for StorageMaximumLevel and StorageWarningLevel is in bytes, so if you want 100 mb it will be 10010241024.
http://itfreesupport.com/wp-content/uploads/2014/12/0116-300x92.png
In Central Admin we see
http://itfreesupport.com/wp-content/uploads/2014/12/0115-300x150.png
Delete a Quota template
1. $q =[Microsoft.SharePoint.Administration.SPWebService]::ContentService
2. $q.QuotaTemplates.Delete("Quota Temp1?)
http://itfreesupport.com/wp-content/uploads/2014/12/0121-300x25.png
In Central Admin we see
http://itfreesupport.com/wp-content/uploads/2014/12/0122-300x63.png
Update code level and storage limit of existing Quota template
1. $c =[Microsoft.SharePoint.Administration.SPWebService]::ContentService
2. $QTemp = $c.QuotaTemplates["Quota Temp"];
3. $QTemp.Name = "Quota Temp"
4. $QTemp.UserCodeMaximumLevel = 500
5. $Qtemp.StorageMaximumLevel = 115343360
6. $c.Update()
Note: Increased the Quota template from 100 mb to 110 mb and UserCodeMaximumLevel to 500
http://itfreesupport.com/wp-content/uploads/2014/12/0117-300x76.png
In Central Admin we see
http://itfreesupport.com/wp-content/uploads/2014/12/0118-300x117.png
Assign a Quota template to a site Collection:
(Note Quota can only be assigned to site collection and not web application or subsite)
1.$QTemp = "Quota Temp1?
2.$site = "http://synhnjseza1181:20000/sites/upload"
3.Set-SPSite -Identity $site -QuotaTemplate $quotaTemplate
http://itfreesupport.com/wp-content/uploads/2014/12/0119-300x32.png
In Central Admin we see:
http://itfreesupport.com/wp-content/uploads/2014/12/0120-300x264.png
References
- http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spquotatemplate%28v=office.12%29.aspx
- http://itfreesupport.com/2014/12/break-permission-inheritance-with-sharepoint-2010-2013-and-online/