Managing SharePoint 2010 web application setting with PowerShell

In my previous post, we looked at how you can manage site collection quotas and provisioning the template for the quota using PowerShell
Some settings can not be set as a quota template but are available out there for you to adjust based on your needs.
In here we’ll take a look at how you can manage recycle bin retention settings for the site collection as well as how much information users can upload to your libraries.
Above two settings will help you manage the storage of your SharePoint 2010 site.
I assume you`re running a sandbox environment similar to 2010 IW demo from Microsoft.
Open SharePoint 2010 Management Shell and execute the following set of commands:

$SiteUrl = "http://www.contoso.com"

Write-Host "Connecting to site"
$SPSite = Get-SPSite | Where-Object {$_.Url -eq $SiteUrl}
if($SPSite -ne $null)
{
Write-Host "Updating maximum file size upload limit"
$SPSite.WebApplication.MaximumFileSize = 100
$SPSite.WebApplication.Update()

Write-Host "Updating recycle bin settings"
$SPSite.WebApplication.RecycleBinEnabled = $true
$SPSite.WebApplication.RecycleBinRetentionPeriod = 15
$SPSite.WebApplication.Update()
}
$SPSite.Dispose()

Above, we accessed the site collection available in the send box and accessed the parent web application. Since all of the settings we spoke of earlier are web application settings, we need to update the underlying web application object when we are ready with committing our changes.
The MaximumFileSize setting in this case will determine the maximum size of files uploaded to document libraries on the site. This isn’t the timeout setting so what’s going to happen is that files that are over the limit will be uploaded, evaluated, and then rejected if the size exceeds the limit. This might be a bit of a pain for users since they have to wait till the end before finding out whether their file is saved.
Recycle bin property RecycleBinRetentionPeriod, naturally self explanatory, will specify the number of days files will be stored in recycle bin for until deleted.

Enjoy!

This entry was posted in sharepoint 2010 and tagged , , . Bookmark the permalink.

Comments are closed.