Skip to content

How to use the export mailbox migration information and troubleshooting PowerShell script | Part 5#5

In the following article, we review how to use the “Export mailbox migration information and troubleshooting” PowerShell script.

The PowerShell script structure

The menu PowerShell script is dived to couple of sections that we will review later in the article.

The PowerShell script was designed to work in two different environments: Office 365 (Exchange Online) and On-Premises environment that include On-Premise Active Directory and Exchange On-Premises.

  • The part that marked as “A” in the screenshot, include the menu options that relates to the Exchange Online infrastructure.
  • The part that marked as “B” in the screenshot, include the menu options that relates to the On-Premise environment.
Export mailbox migration information and troubleshooting PowerShell script – structure -01

Menu 1 – Login to Exchange Online using Remote PowerShell

This menu option will start a remote PowerShell session with Exchange Online.

Login to Exchange Online using Remote PowerShell -01

You will need to provide your Office 365 Global Administrator credentials.

Login to Exchange Online using Remote PowerShell -02

SECTION A: Export mail migration information

The PowerShell menu options in this section, will export information about the various mailbox migration “entities” in a bulk mode.

For example, in case that you run multiple mail migration batches, the below menu options, will export information about ALL the existing migration batched, all migration users, all move requests and so on.

Exported file information

  • The information will be exported to the following file formats: TXT, CSV, HTML and XML.
  • The PowerShell script will automatically create the following folder structure C:\INFO\Mail migration Logs\A-BULK which will contain the exported files.

Menu 2 – Export information about – ALL Migration batches + EndPoints (Bulk Mode)

This menu option, export information about all existing Migration batches + All existing + EndPoints.

The PowerShell commands that are executed by the menu option are:

  • Get-MigrationBatch -IncludeReport -Diagnostic
  • Get-MigrationBatch

Menu 3 – Export information about – ALL Move requests (Bulk Mode)

To demonstrate the process of exporting information to various file type, we use “menu 3” as an example (all the rest of the menu option that export data to file operate in the same manner).

This menu option, export information about all existing move requests + move request statistics.

The PowerShell commands that are executed by the menu option are:

  • Get-MoveRequest
  • Get-MoveRequestStatistics
Menu 3 - Export information about - ALL Move requests -Bulk Mode -01

When we type “3” and “ENTER”, the menu option will automatically start to collect the required information and export the information to various file type.

In the following screenshot, we can see the different information “parts” that appear on the PowerShell console.

  • Part 1 – this part is use for, providing a short explanation about what is the specific PowerShell menu option “do”.
  • Part 2 – this part is use for providing information about – the folder hierarchy that will be created by the PowerShell command. This folder will use for storing the exported files.
  • Part 3 – this part is use for providing information about – the PowerShell command that are executed by the menu option.
  • Part 4 – this part is use for displaying information about the folders that are created by the PowerShell menu option.
Menu 3 - Export information about - ALL Move requests -Bulk Mode -02

In the following screenshot, we can see the folder structure that was created. In our scenario, the information about the move requests is stored in two different folders: 3. MoveRequest and 4. MigrationStatistics.

Menu 3 - Export information about - ALL Move requests -Bulk Mode -03

The information about the Move Requests was exported to three different file formats: TXT, CSV, and HTML.

Menu 3 - Export information about - ALL Move requests -Bulk Mode -04

In the following screenshot, we can see an example of the HTML report that includes information about all existing Move Requests.

Menu 3 - Export information about - ALL Move requests -Bulk Mode -05

In the following screenshot, we can see an example of the HTML report that is stored in the second Directory – “4. MigrationStatistics“, that include information about all existing Move Requests Statistics.

Menu 3 - Export information about - ALL Move requests -Bulk Mode -06

In the following screenshot, we can see an example of the CSV file that includes information about all existing Move Requests.

Menu 3 - Export information about - ALL Move requests -Bulk Mode -07

Menu 4 – Export information about – ALL Migration users (Bulk Mode)

This menu option, export information about all existing migration users + existing migration user’s statistics.

The PowerShell commands that are executed by the menu option are:

  • Get-MigrationUser
  • Get-MigrationUserStatistics -IncludeReport -Diagnostic -IncludeSkippedItems

SECTION B: Export mail migration information – Specific USER

Menu 5 – Export mail migration information for a Specific Migrated USER

The purpose of this menu option is, to get a detailed report about specific “migrated user account”.

The PowerShell commands that are executed by the menu option are:

  • Get-MigrationUser <User>
  • Get-MigrationUserStatistics -IncludeReport -Diagnostic -IncludeSkippedItems <User>
  • Get-MoveRequest <User>
  • Get-MoveRequestStatistics <User>

Exported file information

  • The information will be exported to the following file formats: TXT, XML and HTML
  • The files will be saved in the following path: C:\INFO\Mail migration Logs\B- Migration Users\<User Name>

SECTION C: Export mail migration information Specific migration batch

Menu 6 – Export mail migration information Specific migration batch

The purpose of this menu option is, to get a detailed report about specific “migration batch”.

The PowerShell commands that are executed by the menu option are:

  • Get-MigrationBatch <Migration BATCH name> -IncludeReport -Diagnostic
  • Get-MigrationUser

Exported file information

  • The information will be exported to the following file formats: TXT, XML and HTML
  • The files will be saved in the following path: C:\INFO\Mail migration Logs\C- Migration Batch Information – <Migration BATCH name>

SECTION D: On-Premise Environment

This menu section is dedicated to the on-Premises environment.

In some scenario of troubleshooting mail migration from on-Premises infrastructure, we need to get information about “on-Premises objects” such as On-Premise Active Directory user accounts and Exchange on-Premises mailboxes.

Menu 7 – Export information about On-Premise Active Directory Specific user account

The PowerShell command that are executed by the menu option IS:

Get-Aduser <On-Premise Active Directory user name> -Properties *

Exported file information

  • The information will be exported to the following file formats: TXT, XML and HTML
  • The files will be saved in the following path: C:\INFO\D. On-Premise information\1.On-Premise Active Directory

Note: The following PowerShell command, should be executed from the On-Premise environment, using a Domain controller server or a server that include Active Directory PowerShell cmdlets.

Menu 8 – Export information about Exchange on-Premises mailboxes

The PowerShell commands that are executed by the menu option are:

  • Get-Mailbox <Recipient name>
  • Get-MailboxStatistics <Recipient name>

Exported file information

  • The information will be exported to the following file formats: TXT, XML and HTML
  • The files will be saved in the following path: C:\INFO\D. On-Premise information\2.Exchange on-Premises

Note: The following PowerShell command, should be executed from the On-Premise environment, using an Exchange on-Premises PowerShell.

SECTION E: Exchange on-Premises tasks

The following section is dedicated to “troubleshooting procedure” that relate to the Exchange on-Premises infrastructure

Menu 9 – Test the Exchange on-Premises MRS Proxy service

Get-WebServicesVirtualDirectory <Exchange on-Premises server name>\*” | Format-List Identity,MRSProxyEnabled ,InternalAuthenticationMethods,ExternalAuthenticationMethods,InternalUrl,ExternalUrl
Test-MRSHealth <Exchange on-Premises server name>

Menu 10 – Run mailbox repair

This menu option will run MailboxRepairRequest for a specific mailbox

New-MailboxRepairRequest -Mailbox <Exchange on-Premises mailbox> -CorruptionType ProvisionedFolder,SearchFolder,AggregateCounts,Folderview

Menu 11 – Copy IIS log files

Exported file information

  • The information will be exported to the following file formats: TXT,
  • The files will be saved in the following path: C:\INFO\Exchange on-Premises information\IIS Log files

Download Mail Migration PowerShell script

The previous article in the current article series

Using PowerShell for view and export information about mailbox migration to Office 365 | Part 4#5

o365info Team

o365info Team

This article was written by our team of experienced IT architects, consultants, and engineers.

This Post Has One Comment

  1. I have a couple of things about this. 1. Exchange Online has changed the -Diagnostic to be -DiagnosticInfo verbose I had to update the script changing that so that it would work. Additionally I’m having a hard time getting a report for all of my migration jobs that shows mailboxes that failed to sync. I have 30 batches, yeah I know it should have been one batch :(, and I just want a consolidated report. Any help would be great. Thanks.

Leave a Reply

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