Last active
December 13, 2015 21:18
-
-
Save nigamankit7/4975749 to your computer and use it in GitHub Desktop.
This powershell script for SharePoint 2010 iterate through each site collection in a given web application. First it moves content from each web recycle bin to site collection recycle bin and then delete it from the site collection "Admin Recycle Bin" URL Shortcuts for accessing Recycle bin: /_layouts/recyclebin.aspx - For Web Recycle Bin
/_layo…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue | |
$WebApp=get-spwebapplication "http://webapplicationname" | |
foreach ($SPSite in $webApp.Sites) | |
{ | |
foreach($SPWeb in $SPSite.AllWebs) | |
{ | |
$SPWeb.RecycleBin.MoveAllToSecondStage(); | |
write-host "Web Recycle Bin Items Deleted for:" | |
write-host $SPWeb.title ":" $SPWeb.URL "`n" | |
} | |
$SPSite.RecycleBin.DeleteAll(); | |
write-host "Administrator Recycle bin Items Deleted for:" $SPSite.RootWeb.title "`n" | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment