Exchange 2010 Powershell script to clear recovery items

Recovery items in users mailboxes can substantially increase the overall size of your store. If you would like to clear these out of all users mailboxes create the following two script files to use

Flush_recovery_items.cmd

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command “. ‘c:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1’; Connect-ExchangeServer -auto; cd c:\scripts\ ; .\Flush_recovery_items.ps1”

Flush_recovery_items.ps1

Get-User -RecipientType UserMailBox | Search-Mailbox -SearchDumpsterOnly -DeleteContent -confirm:$false

You will be prompted to continue and can select Y to go mailbox by mailbox, or press A to continue deleting from All mailboxes

080412_2250_Exchange20111