Note: Before going through the please go through my first post in power shell series which convers how to use PS scripts.
We will use the below script to clean up the items from the recycle bin.
$webApp=get-SPWebApplication "http://sharepointblog"
foreach ($SPSite in $webApp.Sites)
{
#Here we are looping through all the web under site collection
foreach($SPWeb in $SPSite.AllWebs)
{
#Cleaning the 1st Stage of Recycle bin items
$SPWeb.RecycleBin.DeleteAll();
#Moving the all the items to 2nd stage level
$SPWeb.RecycleBin.MoveAllToSecondStage();
}
#Clean SharePoint site collection
$SPSite.RecycleBin.DeleteAll();
}
No comments:
Post a Comment