Recycle bin retention period setting using PowerShell
30 November 2011

In SharePoint 2010 there is a recycle bin property called “RecycleBinRetentionPeriod”. This property specifies the number of days files will be stored in recycle bin and then will be deleted after that period.
I wrote a PowerShell script to set the SharePoint 2010 site retention period without much hassle.
$siteUrl = "http://eblogin.com"
Write-Host "Connecting to the site"
$SPSite = Get-SPSite | Where-Object {$_.Url -eq $siteUrl}
if($SPSite -ne $null)
{
$SPSite.WebApplication.RecycleBinEnabled = $true
$SPSite.WebApplication.RecycleBinRetentionPeriod = 20
$SPSite.WebApplication.Update()
}
$SPSite.Dispose()
Hope this will help.




































