Recycle bin retention period setting using PowerShell

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.

More Blogs

Contact us

To begin your digital transformation, get in touch.

We’re pleased to address any inquiries you might have and assist you in selecting the service that best suits your requirements.

Your benefits:
Speak To Us