Emptying all site recycle bins
-
10-12-2019 - |
Question
Is it possible to empty all recycle bins in a site collection? I tried going into the recycle bin located on the admin page but it was empty.
Solution
The following powershell script will delete all items in the site collection recycle bin and recycle bins of each of the webs in the provided sitecollection url:
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint");
$site = new-object microsoft.sharepoint.spsite("SITE COLLECTION URL");
for ($i=0;$i -lt $site.allwebs.count;$i++)
{
if($site.allwebs[$i].recyclebin.count >0)
{
$site.allwebs[$i].recyclebin.deleteall();
}}
$site.recyclebin.deleteall();
$site.dispose();
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange