Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
PowerShell Script to Cleanup all Recycle Bins in a Site Collection in SharePoint 2013
WhatsApp
Gowtham Rajamanickam
9y
5.2
k
0
1
25
Blog
Open PowerShell window in your system.
Paste the below code in your PowerShell window.
Run the script.
[System.Reflection.Assembly]::LoadWithPartialName(
"Microsoft.SharePoint"
);
$url = $args[0];
$site =
new
-object microsoft.sharepoint.spsite($url);
for
($i=0;$i -lt $site.allwebs.count;$i++)
{
write-host $site.allwebs[$i].url
"...deleting"
$site.allwebs[$i].recyclebin.count
"item(s)."
;
$site.allwebs[$i].recyclebin.deleteall();
}
write-host $site.url
"...deleting"
$site.recyclebin.count
"item(s)."
;
$site.recyclebin.deleteall();
$site.dispose();
PowerShell script to cleanup all recycle bins in a site collection in SharePoint 2013
Up Next
Disk Cleanup Using Powershell Scripts
Ebook Download
View all
Printing in C# Made Easy
Read by 22.3k people
Download Now!
Learn
View all
Membership not found