How To Get The Total Number of BadItems and Kind of BadItems for Failed Move Requests

A common bad practice when it comes to migrating mailboxes, is to set the badItem limit to 10, 20, 30, 40, 50 etc, and keep incrementing until Resume-MoveRequest finally works. When you do this, you’re blindly accepting large data loss, without knowing exactly what kind of items are corrupt or the total amount beforehand.

Here is a simple way of determining the total number of corrupt / bad items a mailbox move request has encountered, and exactly what type/kind the bad items are. In order to utilize this guide, you will need to connect to Exchange Online PowerShell if you’re moving the mailbox to o365, or use the on premises Exchange Management Console if you migrating on premises.

Before we start I will provide you with a basic summary of what we’re doing to accomplish this task. We are going going to take the MoveRequestStatistics of the mailbox and export that data to XML. Doing this supplies us with a number of details that are not prevalent within the standard -IncludReport switch. Once we have exported the data to XML, we will import it back into powershell and store it in a variable, which we will access using dot notation.

Step 1. Connect to Exchange Online Powershell OR open Exchange Management Console.

Step 2. Export the MoveRequestStatistics Report to XML:
Get-MoveRequestStatistics -Identity user@contoso.com -IncludeReport | Export-CliXML C:\Location\of\YourChoice\FileNameGoesHere.xml

Step 3. Import the XML data and store it in a variable:
$BadItems = Import-CliXML C:\Location\of\YourChoice\FileNameGoesHere.xml

Step 4. Review the total number of items and the kind of items that are corrupt:
$BadItems.report.baditems.count (this is to get the total count)

$badItems.report.baditems.kind (this is to view the kinds of bad items)

**Bonus**
BadItems.report.baditems | Out-GridView (This will open a GUI explorer to review all of the bad items and their kinds.

Before we go on to step 5, I would like you to understand a few types of acceptable bad data… that would be Security Descriptors and Calendar Properties. Those tend to be the most common. Be careful not to accept actual corrupt items. Once you have determined the kinds of items are within scope of acceptable data loss.. move on to step 5.

Step 5. Increase the bad item limit to the total number you retrieved for the cmdlets above:
Set-MoveRequest -Identity user@contoso.com -BadItemLimit 25

Step 6. Resume the move request (or set -CompleteAfter switch to $null, depending on your scenario)
Resume-MoveRequest -Identity user@contoso.com

OR Set-MoveRequest -identity user@contoso.com -CompleteAfter:$null

How to fix “RequestExpiryCleanup” Error in a Hybrid Exchange Environment.

Scenario:
Hybrid Exchange Environment is in place and you are having problems off boarding a mailbox from Exchange Online (Office 365).

Symptoms:
When you attempt to off board the user, the move request takes an unusual amount of time to validate. Once it finally validates, the move request is generated but the request gets stuck at 0% and shows a StatusDetail of “RequestExpiryCleanup”.

Things You’ve Already Tried:
You have attempted to remove the move request and have created a new off boarding request a few times. However, the problem still persists.

Solution:
Do a targetless move request from within Exchange Online. This will move the mailbox into a different database within Exchange Online. Here’s how:

1. Connect to Exchange Online PowerShell

2. Remove the problematic move request and migration user:

Remove-MoveRequest -Identity stuckuser@contoso.com
Remove-MigrationUSer -Identity stuckuser@contoso.com

3. Perform the targetless move request (move the mailbox to a new DB in EXO)

New-MoveRequest -Identity stuckuser@contoso.com

Once the new move request finishes, go back into the Exchange Admin Center via the O365 portal (or use PowerShell) and generate a new off boarding request.

Hope this helps!