Wednesday, 15 June 2016

PowerShell script to empty first level & Secondary level recycle bin in SharePoint

PowerShell script to empty first level & Secondary level recycle bin in SharePoint
$sitecollectionUrl = “<Site Collection URL>”
$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();
===========================================
If you run First time it will remove items on second level recycle bin and move the files from first level recyclebin to second level.
If you run second time files will delete from second level. 
Visit Facebook page for more scripts and details MySharepoint
Enjoy 

No comments:

Post a Comment