This is a random script I put together due to a one off issue I have been having. I have a script that I use to clear items from a large list. Unfortunately it dumps these deleted items into the SharePoint Recycle bin for that site collection. Normally this wouldn’t be too big of an issue, but when I say this list is large, I really mean like it can get million items large. So what I do is use a script that deletes the items in 1000 item batches. Again, no problem until a site owner needs to find a random file that was deleted by a user and has to click through 15 pages to find it. Doesn’t make the easy task for them, so easy and quick anymore.

That said I created couple lines in my batch delete script that will delete the items in the recycle bin based upon who deleted the item. And it works great, but since I had 80k items in my recycle bin, I needed a way to tell if things are really getting deleted. Since there doesn’t appear to be a item count in the UI for the recycle bin.

Since I figured I may need this again, or someone somewhere may run into a similar situation, I’d just post it.

So here ya go!

<code>

Add-PSSnapin Microsoft.SharePoint.PowerShell
$spSite = “http://myspsite.com/sites/siteA”
$recycle = (Get-SPSite $spsite).RecycleBin
$recycle.count

</code>

 

(1852)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.