Archive for October, 2012

Search the recycle bin with Powershell

17 October 2012 Leave a comment

Useful piece of Powershell to search for a file(s) / item(s) in the site recycle bin and then restore it/them.

Change the regular expression after match to change what files to search for.

$spsite = (Get-SPSite “http://mysite” )
$files = $spsite.RecycleBin | ?{$_.Title -match “myfile\d{2}”}

foreach ($file in $files) {

Write-Host “Found $($file.Title)”


Categories: Code Tags: , ,