Export Mailbox New-MailboxExportRequest

Export Mailbox New-MailboxExportRequest

Hello folks, Today I would like to share my experience so far on how to export a mailbox with New-MailboxExportRequest. There are a couple of parameters to query to get useful information about the status of an export request.

As long as everything goes smooth you will probably just need the percentage information. But when the New-MailboxExportRequest stalls or stops with an error you will be happy to have some additional parameters to query at your disposal.

So let’s get to the point straight away:

Start to export a mailbox with New-MailboxExportRequest:

New-MailboxExportRequest -Mailbox MailboxName -Name ExportRequestName -BatchName BatchName -BadItemLimit 0 -LargeItemLimit 0 -FilePath “\\ServerName\ExportLocationFolder\MailboxName.pst” -Priority Emergency

Use the -Priority switch with Emergency to prevent stalling!

After you have started the export request check the progress:

Get-MailboxExportRequest -Name ExportRequestName -BatchName BatchName | Get-MailboxExportRequestStatistics -IncludeReport | select Report, name,Priority, FailureCode, FailureType,DiagnosticInfo,BadItemLimit,BadItemsEncountered,LargeItemLimit,LargeItemsEncountered, OverallDuration, Status, StatusDetail,EstimatedTransferSize,BytesTransferred, EstimatedTransferItemCount, ItemsTransferred,PercentComplete

As a result, you will get the values of the selected parameters.
Adjust the selected parameters if the output gets too long or intransparent.
For example remove -IncludeReport

You can find a description of the selected parameters below.

First, a short info on the -IncludeReport switch:

When this switch is used in accordance with select Report the ouptut looks like this:

New-MailboxExportRequest -IncludeReport
The output displays the currently processed items. Depending on the mailbox size the output can get much longer. Below the report, the output of other parameters you have selected is displayed.

New-MailboxExportRequest relevant infos that can be selected:

Report: Displays the whole export request history when used with the -IncludeReport switch. Skipped items based on bad or large items limits are also displayed.
Name: The individual name of the mailbox export request.
Priority: Possible values are Lower, Low, Normal (This is the default value), High, Higher, Highest, Emergency [Use the highest priority to prevent stalling. I usually use Emergency]
FailureCode: Displays the failure code [ not really useful unless you find a list of failure codes for export requests. I couldn’t find one.]
FailureType: Description of the failure that stopped the mailbox export request.
DiagnosticInfo: This needs to be used with the -Diagnostic switch when selected to display diagnostic information. Among others, you will be able to see job pickup results and timestamps.
BadItemLimit: The max. amount of inconsistent items that will be skipped and will not be exported. When this limit is reached the export will fail. A BadItemLimit greater than 50 requires the -AcceptLargeDataLoss switch.
BadItemsEncountered: Number of bad items found during the export.
LargeItemLimit: The max. amount of items in the mailbox that exceeds the allowed message size. The default value is 0. A value higher than 50 requires the -AcceptLargeDataLoss switch. (not recommended)
LargeItemsEcountered: Number of large items found during the export.
OverallDuration: Duration of the mailbox export. Includes times of stalling as well.
Status: The current state of the export. Relevant values are inProgress, Queued, Completed, Failed, Suspended.
StatusDetail: Displays additional information on some states.
EstimatedTransferSize: Estimates and displays the amount of the exported data.
BytesTransferred: Displays the amount of data that has been really transferred. This usually differs from the EstimatedTransferSize.
EstimatedTransferItemCount: Estimates and displays the number of items that will be transferred.
ItemsTransferred: Displays the number of items that have been transferred. Can differ from EstimatedTransferItemCount. ( Among others depending on encountered bad or large items and the associated limits )
PercentComplete: The progress of the export request in percent.

See the standard reference to Get-MailboxExportRequest by Microsoft here.
Find more to Get-MailboxExportRequestStatistics by Microsoft under this link.

Modify parameters of a mailbox export request:

To modify the parameters of an existing mailbox export request you will need to suspend the request first. This can be useful when you retrospectively want to change the BadItemnLimit or want to raise the priority.

Suspend the mailbox export request:

Get-MailboxExportRequest -Name ExportRequestName | Suspend-MailboxExportRequest

In case you want to suspend all mailbox exports of the same batch:

Get-MailboxExportRequest -BatchName BatchName | Suspend-MailboxExportRequest

Now change the parameters [Example: BadItemLimit]

Get-MailboxExportRequest -Name ExportRequestName | Set-MailboxExportRequest -BadItemLimit 25

In order to change all export requests of the same batch:

Get-MailboxExportRequest -BatchName BatchName | Set-MailboxExportRequest -BadItemLimit 25

Resume the mailbox export request:

Get-MailboxExportRequest -Name ExportRequestName | Resume-MailboxExportRequest

In case you want to resume all mailbox exports of the same batch:

Get-MailboxExportRequest -BatchName BatchName | Resume-MailboxExportRequest
Note:
Modifying the BadItemLimit value makes sense when you have started the export with a low BadItemLimit ( for exmaple 5 ). While monitoring the export you assume that there will be more bad item than you have specified.

Another case would be when the export fails because the BadItemLimit threshold has been reached. In that case, you can modify the BadItemLimit after the export failed and resume the export. Suspend is not needed here as it has already failed. To be honest I usually trigger a New-MailboxExportRequest when this happens because I don’t trust the resume. I am not 100 percent sure that the resume picks up where it stopped and I want to prevent duplicated items. But if you trust the resume process more than me give it a try.

Remove-MailboxExportRequest

Here are two arguments to remove mailbox export requests you don’t need anymore:

  • To export a mailbox with New-MailboxExportRequest with the same request name.
  • Further, do some housekeeping and keep your environment clean and transparent.
Get-MailboxExportRequest -Name ExportRequestName | Remove-MailboxExportRequest

In case you want to remove all mailbox exports of the same batch:

Get-MailboxExportRequest -BatchName BatchName | Remove-MailboxExportRequest

In order to remove all mailbox export requests:

Get-MailboxExportRequest | Remove-MailboxExportRequest
Final remark:
Get-mailboxExportRequest vs. Get-MailboxExportRequestStatistics:
Whenever an export request got stalled and I monitored the request with Get-MailboxExportRequest it showed me InProgress as the current state.

Only Get-mailboxExportRequest | Get-MailboxExportRequestStatistics showed me the real status.
It seems regarding the state of the export Get-mailboxExportRequest is not as much reliable as Get-MailboxExportRequestStatistics.
For this reason I always use Get-MailboxExportRequestStatistics when I export a mailbox with New-MailboxExportRequest.

Have a nice day!

Leave a Reply

Your email address will not be published. Required fields are marked *