Wednesday, July 19, 2017

ShareClear RecycleBin Using Powershell

Add-PSSnapIn Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue;
$sitecollectionUrl = ""
$siteCollection = New-Object Microsoft.SharePoint.SPSite($sitecollectionUrl)
write-host("Items to be deleted : " +$siteCollection.RecycleBin.Count.toString())
$now = Get-Date
write-host("Deleting started at " +$now.toString())
$siteCollection.RecycleBin.DeleteAll();
$now = Get-Date
write-host("Deleting completed at " +$now.toString())
$siteCollection.Dispose();

No comments: