Wednesday, 22 April 2015

Identifying corrupted mailboxes in Exchange 2013

We can use the -DetectOnly switch of New-MailboxRepairRequest in order to identify if any of the mailbox's within a database have been corrupted.

To perform a mass check of all the mailboxes in a database we can use:

Get-MailboxDatabase -Identity "database-name" | Get-Mailbox |  New-MailboxRepairRequest -CorruptionType ProvisionedFolder,SearchFolder,FolderView,AggregateCounts -DetectOnly

or to perform a check on a single mailbox check:

New-MailboxRepairRequest -Mailbox "user@domain.com" -CorruptionType ProvisionedFolder,SearchFolder,FolderView,AggregateCounts -DetectOnly

And to check the progress of the request:

Get-MailboxRepairRequest -Mailbox "Ann Beebe" | FL

or to check all of them for a specific mailbox database we can use the following powershell script:

$mailboxes = Get-MailboxDatabase -Identity "database-name" | Get-Mailbox
foreach ($mailbox in $mailboxes) {
  $MailboxGuid = Get-MailboxStatistics $mailbox
  Get-MailboxRepairRequest -Database $MailboxGuid.Database -StoreMailbox $MailboxGuid.MailboxGuid
}

0 comments:

Post a comment