Quantcast
Channel: SharePoint Diary
Viewing all articles
Browse latest Browse all 1058

Set SharePoint Web Application Recycle Bin configuration Programmatically with PowerShell

$
0
0
In continuation to my article SharePoint Recycle bins - Lets get it crystal clear , There are situations to set SharePoint recycle bin options programmatically with either object model code (C#) or with PowerShell.

SharePoint 2010 powershell Script to Configure Recycle Bin:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Get the Web Application
$WebApp = Get-SpWebApplication "http://SharePoint.crescent.com"

#*** Set Recycle bin Options ***
#Enable Recycle bin
$WebApp.RecycleBinEnabled = $true

#Set Retention Period to 90 days
$WebApp.RecycleBinRetentionPeriod = 90 
#To Turnoff Recycle bin Retention, use: $WebApp.RecycleBinCleanUpEnabled=$false

#Set Second Stage Recycle bin Quota %
$WebApp.SecondStageRecycleBinQuota = 100
#To turn OFF Second Stage recycle bin, use: $WebApp.SecondStageRecycleBinQuota = 0

#Apply the changes
$WebApp.Update()

Write-Host "Recycle bin Settings Updated!"

SharePoint Recycle bin configuration with STSADM:
  • stsadm -o setproperty -pn Recycle-bin-enabled –pv {On | Off} -url <web-app-url>  
  • stsadm -o setproperty -pn Recycle-bin-cleanup-enabled –pv {On | Off} -url <web-app-url>
  • stsadm -o setproperty -pn Recycle-bin-retention-period –propertyvalue <Numeric value indicating the number of days> [-url] <URL>
  • stsadm -o setproperty -pn Second-stage-recycle-bin-quota -pv 60 -url <web-app-url>

Viewing all articles
Browse latest Browse all 1058

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>