In this blog post I’m going to display how to delete all items from recycle bin of any SharePoint Site using PowerShell script.
Steps:
- PowerShell script we can get the object of SPSite and SPWeb like this
$Site = Get-SPSite “SiteUrl”
$RootWeb = $Site.RootWeb - We can iterate through all the subsites in any site using foreach loop
foreach($web in $RootWeb.Webs) - Next we need to call the DeleteAll method of Recycle Bin.
{
$web.RecycleBin.DeleteAll();
} - Next we need to clear the level 2 recycle bin i.e. at site collection level
$Site.RecycleBin.DeleteAll(); - And lastly we need to dispose the SPSite object
$Site.Dispose();
That’s all you need to delete all items from recycle bin.