Using PowerShell to Manage Office 365 Hybrid Mailbox Moves

Using PowerShell to Manage Office 365 Hybrid Mailbox Moves

By Dan Knowlden

Senior Systems Engineer


Doing a staged mailbox migration from a Hybrid Exchange installation to Office 365? I recommend avoiding the GUI and using PowerShell commands instead. Why? Because…

  • The GUI doesn’t scale – While the GUI will work okay if you’re moving less than 100 mailboxes, for larger-scale projects the GUI is just too slow. You can only have so many batches in the GUI, and the more batches you have the slower and slower it runs. Each time you add another batch your ability to click from screen to screen within the GUI becomes ever more painfully slow.
  • PowerShell gives you granular control – Even if you have less than 100 mailboxes to move, the lack of granularity can still be a significant disadvantage with the GUI.

First, when you use PowerShell you can easily find the migration report for each individual mailbox…a task that can be a real time consumer with the GUI. When you use the GUI you have to click through a series of screens that each have to refresh, pull in the data, and so forth. The more batches you do, the slower this process becomes. Second, using PowerShell gives you control over exactly when each individual mailbox will be moved, and therefore when each user’s day will be interrupted with a prompt that they need to restart Outlook.


3 PowerShell Commands to Migrate Mailboxes to the Cloud

The system that I use is based on just three PowerShell commands, which I am providing below. Feel free to copy these for your own use.

  • Command #1: Initiate – Similar to what you would do in the GUI, this simple mailbox move command initiates the move request, sets a “bad item” limit, and then auto-suspends it when completed. If desired, you can add additional things to this command, such as a “large item” limit and an email address to be notified when the task is complete.

New-MoveRequest -Identity alias -remote -RemoteHostName -TargetDeliveryDomain -RemoteCredential $onprem -BadItemLimit 50 –SuspendWhenReadyToComplete

To simplify the process you can use Excel to generate these commands. Get a list of users in CSV format, and then use this to generate the move request command for each user. Once you have your list of commands you can then either put them into a PowerShell script to be run as a group, or run them individually by pasting them from Excel into the shell.

  • Command #2: Check Status – The second command gives you the status of the mailbox moves that you initiated with command #1. This helps with the timing of the next step in the process.

Get-MoveRequest | where {$_.status -notlike “complete*”} | Get-MoveRequestStatistics | Select DisplayName,status,percentcomplete,itemstransferred

If you want to get more detailed information about the mailbox move, you can simply add other things to the end of the command. For example, here’s what the command would look like if you also wanted to get a “bad item” count so you can see if any of the mailboxes in the batch contain any corrupt items.

Get-MoveRequest | where {$_.status -notlike “complete*”} | Get-MoveRequestStatistics | Select DisplayName,status,percentcomplete,itemstransferred,BadItemsEncountered

  • Command #3: Finish – The third command finishes the process of moving the mailbox from the on-prem Exchange system to Office 365.

The following command will complete just one move request, which would be for one user:

Get-MoveRequest “User, Mail” | Resume-MoveRequest

This command will complete all of the move requests that are in auto suspend:

Get-MoveRequest -MoveStatus AutoSuspended | Resume-MoveRequest


If you’re handling a mailbox migration yourself, these commands can be of great help to you. If you’re not yet comfortable with PowerShell (I have found that many people are not), I hope that these commands will help you get over the learning curve to make use of this powerful tool. Of course, if you want assistance with your Hybrid Exchange to Office 365 migration, give us a call!


More Information

If you’re curious about our other services, we also provide Atlassian services, Atlassian Licence management and sales, as well as Recruiting and Remote Monitoring & Management.


Contact us if you would like to know more about our Microsoft services.
  • This field is for validation purposes and should be left unchanged.