To Empty Recycle Bin in SharePoint 2013

According to MSDN "Recycle Bin gives a site collection administrator greater control when users delete files, versions of files, list items, libraries, lists, and folders from a SharePoint site by providing a second stage safety net before an item is permanently deleted from a site. When a user deletes an item from the Recycle Bin, the item is sent to a second stage Recycle Bin (also known as the Site Collection Recycle Bin) that the site collection administrator manages".
 
There are two stages of Recycle Bin in sharepoint . First stage and Second stage. 
 
$Web=get-spwebapplication "http://mysite"

foreach ($SPSite in $Web.Sites)
{
#Collection of web
foreach($SPWeb in $SPSite.AllWebs)
{

//first stage recycle bin Delete
#$SPWeb.RecycleBin.DeleteAll();


$SPWeb.RecycleBin.MoveAllToSecondStage();

}
#Empty SharePoint site collection recycle bin Second Stage Recycle Bin.
$SPSite.RecycleBin.DeleteAll();
     }
 
Happy SharePointing :-) 
Ebook Download
View all
Learn
View all