Saturday, January 16, 2016

Office 365 Import Service: Get-MailboxImportRequest and Get-MailboxImportRequestStatistics

Office 365 Import Service (currently in Preview and free) can provide PST files import via network copy and it is a two-step process, from copying the files to Azure and then importing the PST into Exchange online. Recently I've described how to throttle traffic during PST upload to Azure Storage account. Now I'd like to document issues we've got during Import process (Mailbox Import Request):


There are two PowerShell cmdlets you can use to control import process: Get-MailboxImportRequest and Get-MailboxImportRequestStatistics:

PS > Get-MailboxImportRequest

Name                                           Mailbox                  Status
----                                           -------                  ------
54db24b4-b5bb-4750-9455-a11c21c698ac           sarag                    Completed
9c70991e-4998-4667-9e22-ff567c982971           btitus                   Completed
c0f7dbd0-e415-495f-b283-01e16e2d4ddb           ruth                     Completed
4153202d-2eb3-406f-8e43-6895dc70e3ac           larry                    Completed
b1dc5874-ae7b-4d70-8987-6171b788521f           ckepes                   Completed
0e00d89c-199f-4fb9-8f5a-c86a97ca433b           btitus                   Completed
5e9397b2-6773-4bfa-989d-c98b9df0b8c0           sarag                    Completed
6cce4b99-dc13-4b3e-9646-232c3c979e7e           pete                     Completed
e3915ef6-c57b-4450-a629-96d823f758fb           roughmill                Completed
14d4a6fa-5efc-4fc9-a0bc-3752767934b7           btitus                   Completed
0ec3c64c-71be-455e-8e53-29ad6226276d           ruth                     InProgress
1efae770-5acb-47a4-94c7-aa9df7197407           ckepes                   Failed
ffd410bc-5767-4f7b-8c34-5119b0e96c7d           adam                     Completed
6312d55b-dfe3-4fba-8193-a408861e10b0           adam                     Completed

PS > Get-MailboxImportRequest -status failed | fl

RunspaceId     : 35130605-b66f-412c-b680-636bf10513eb
FilePath       : AzureImport
Mailbox        : ckepes
Name           : 1efae770-5acb-47a4-94c7-aa9df7197407
RequestGuid    : b132acbb-1272-4959-bdc5-ebe1e0f72b76
RequestQueue   : NAMPR10DG030-db079
Flags          : IntraOrg, Pull, Suspend
BatchName      :
Status         : Failed
Protect        : False
Suspend        : True
Direction      : Pull
RequestStyle   : IntraOrg
OrganizationId : XXXXXXXXX.PROD.OUTLOOK.COM/Microsoft Exchange Hosted Organizations/contoso.onmicrosoft.com - XXXXXXXXX.PROD.OUTLOOK.COM/ConfigurationUnits/contoso.onmicrosoft.com/Configuration
WhenChanged    : 12/23/2015 10:45:41 PM
WhenCreated    : 12/23/2015 7:27:18 PM
WhenChangedUTC : 12/23/2015 8:45:41 PM
WhenCreatedUTC : 12/23/2015 5:27:18 PM
Identity       : ckepes\1efae770-5acb-47a4-94c7-aa9df7197407
IsValid        : True
ObjectState    : New

If you will try Get-MailboxImportRequest | Get-MailboxImportRequestStatistics you will end with:

PS > Get-MailboxImportRequest | Get-MailboxImportRequestStatistics
Couldn't find a request that matches the information provided. Reason: No such request exists in the specified index.
   + CategoryInfo : NotSpecified: (:) [Get-MailboxImportRequestStatistics], ManagementObjectNotFoundException
   + FullyQualifiedErrorId : [Server=XXXXXXXXXXX,RequestId=7ebf175c-0e3c-41dd-a9a8-92d7d07d3a2b,TimeStamp=12/24/201 5 1:24:29 PM] [FailureCategory=Cmdlet-ManagementObjectNotFoundException] 928718B3,Microsoft.Exchange.Management.Migration.MailboxReplication.MailboxImportRequest.GetMailboxImportRequestStatistics
   + PSComputerName : outlook.office365.com

If you have some job failed you can try to fix PST file with scanPST tool and upload it again to Azure. Just like an Exchange migration, PST Imports are limited to the number of failed or corrupt messages that can be skipped in the process. The number is over 200 for an Azure PST Import and appears to be around 218 items. Downloaded Error Report information would be something like:
12/23/2015 8:45:30 PM A missing item was encountered: Missing Item () Subject:"", Folder:"Calendar"
12/23/2015 8:45:30 PM A missing item was encountered: Missing Item () Subject:"", Folder:"Calendar"
12/23/2015 8:45:30 PM A missing item was encountered: Missing Item () Subject:"", Folder:"Calendar"
12/23/2015 8:45:31 PM Fatal error TooManyMissingItemsPermanentException has occurred. 
After another try to increase limit of corrupted items we've ended with another frustrating error:
PS > Get-MailboxImportRequest -Status Failed | Set-MailboxImportRequest -BadItemLimit 500
WARNING: When an item can't be read from the source database or it can't be written to the destination database, it will be considered corrupted. By specifying a non-zero BadItemLimit, you are requesting Exchange not copy such items to the destination mailbox. At move completion, these corrupted items will not be available at the destination mailbox.
Couldn't find a request that matches the information provided. Reason: No such request exists in the specified index.
    + CategoryInfo          : NotSpecified: (:) [Set-MailboxImportRequest], ManagementObjectNotFoundException
    + FullyQualifiedErrorId : [Server=xxxxxxxxxxxxxxx,RequestId=37c78693-1607-458c-be3f-7378e3507efa,TimeStamp=12/24/2015 1:00:47 PM] [FailureCategory=Cmdlet-ManagementObjectNotFoundException] 3D3E249B,Microsoft.Exchange.Management.Migration.MailboxReplication.MailboxImportRequest.SetMailboxImportRequest
    + PSComputerName        : outlook.office365.com

PS > Get-MailboxImportRequest -Status Failed | Resume-MailboxImportRequest
Couldn't find a request that matches the information provided. Reason: No such request exists in the specified index.
    + CategoryInfo          : NotSpecified: (:) [Resume-MailboxImportRequest], ManagementObjectNotFoundException
    + FullyQualifiedErrorId : [Server=xxxxxxxxxxxxxx,RequestId=a3616eca-8348-4e22-9cc8-05bea70d5114,TimeStamp=12/24/201
   5 1:03:27 PM] [FailureCategory=Cmdlet-ManagementObjectNotFoundException] 3D3E249B,Microsoft.Exchange.Management.Migration.MailboxReplication.MailboxImportRequest.ResumeMailboxImportRequest
    + PSComputerName        : outlook.office365.com

So what's wrong here? If you are going to use Set-MailboxImportRequest or Get-MailboxImportRequestStatistics or similar import cmdlets make sure you are using -Identity switch and RequestGuid value from Get-MailboxImportRequest.


PS > Get-MailboxImportRequestStatistics -Identity b132acbb-1272-4959-bdc5-ebe1e0f72b76

Name                                   StatusDetail            TargetAlias  PercentComplete
----                                   ------------            -----------  ---------------
1efae770-5acb-47a4-94c7-aa9df7197407   CreatingFolderHierarchy      ckepes              5
Next PowerShell commands will work for single ImportRequest:
Set-MailboxImportRequest -Identity b132acbb-1272-4959-bdc5-ebe1e0f72b76 -BadItemLimit 500
Resume-MailboxImportRequest -Identity b132acbb-1272-4959-bdc5-ebe1e0f72b76
Next PowerShell commands will work for the few ImportRequests:
Get-MailboxImportRequest | % {Get-MailboxImportRequestStatistics $_.RequestGuid}
Get-MailboxImportRequest -Status Failed | % {Set-MailboxImportRequest  $_.RequestGuid -BadItemLimit 500 | Resume-MailboxImportRequest}

GA Manual released:
https://support.office.com/en-us/article/Use-network-upload-to-import-PST-files-to-Office-365-103f940c-0468-4e1a-b527-cc8ad13a5ea6