Sometimes ago, I run into a strange problem while I was working on an Exchange 2010 server for a client.
By default the retention policy is configured as follow on the Exchange 2007 and 2010 servers.
I moved all the users’ mailboxes from Exchange 2007 SP3 to Exchange 2010 SP3 during a migration process.
After some days, I noticed that the drive containing the mailboxes grow larger than usual. So I run the following cmdlet le check the deleted items information per user.
Get-Mailbox -Database “Database Name” -ResultSize Unlimited | Get-MailboxFolderStatistics -FolderScope RecoverableItems | format-list Identity,ItemsInFolder,FolderSize,FolderType
And I noticed that none of the mailboxes purged their deleted items
I run the following cmdlet to be sure about my configuration
Check the retention period
Get-MailboxDatabase | fl *retention*
Check the reserved space for recoverable items
Get-MailboxDatabase | fl recoverable*
Check the quota of the mailboxes
Get-MailboxDatabase | fl *quota*
I also checked the ManagedFolderAssistantSchedule schedule
Get-MailboxServer servername | fl name, *workcycle*, *ManagedFolderAssistantSchedule*
I left the “do not permanently delete items until database has been backed up” option checked and unchecked. But it didn’t change the situation.
I’m using backup exec 2015 to backup the Exchange server. The log files are purging after the backup and I’m able to restore from backup.
I run Get-MailboxDatabase -Status | ft name,last* -auto to check the backup status and get the following result
This means the backups are running correctly.
Also Exchange server is up to Roll up 12. And Litigation Hold is not enabled. To check the litigation hold I run
Get-Mailbox -server servername | Select LitigationHoldEnabled, LitigationHoldDate, LitigationHoldOwner, RetentionComment, RetentionUrl
And the result was False for all users.
My solution:
All seems ok to me but the problem was not solved, the deleted items still not purging. So I decided to manually purge the deleted items using a powershell script. Here comes the script.
$date = (Get-Date).AddDays(-14)
$Mailboxes = Get-Mailbox -Server servername
foreach ($mailbox in $mailboxes)
{Search-mailbox -identity $mailbox -SearchDumpsterOnly -SearchQuery ‘$date’ –DeleteContent -Force}
As you can see the script is purging RecoverableItems. I used the Get-Date cmdlet to purge only items older than 14 days from each day.
I scheduled the script to run every night. Here is how the task is configured.
Program/Script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Add Arguments: -version 2.0 -NonInteractive -WindowStyle Hidden -command “. ‘E:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1’; Connect-ExchangeServer –auto ; C:\Tools\PurgeDeleted.ps1”
Leave a comment