Set the Storage Limit on a Site Collection using Powershell

We can set storage quota and storage warning quota for a SharePoint site collection by using the powershell cmdlet Set-SPSite with the parameters MaxSize and WarningSize.

Both parameter values are in bytes and work together to set the storage limits on a site collection (MaxSize and WarningSize). The MaxSize parameter can be any integer value but must be greater than or equal to the WarningSize value.

The following command sets the maximum storage size as 10 MB and storage warning size as 8 MB.

Set-SPSite -Identity http://sp01:85  -MaxSize (10 * 1024 * 1024) -WarningSize (8 * 1024 * 1024)

You can use the below command to get the available storage quota and storage warning quota details for all the site collections in SharePoint farm.

Get-SPSite | Select-Object Url,  @{n="Database";e={$_.ContentDatabase.Name}},
@{n="MaxSizeInMB";e={(($_.Quota).StorageMaximumLevel)/1MB }},
@{n="WarningSizeInMB";e={(($_.Quota).StorageWarningLevel)/1MB }} | 
Sort-Object -Descending -Property "MaxSizeInMB"

Advertisement

Leave a Comment