May 30, 2018
| by
iaur
| posted as
Hybrid(EXO) , M365 Migration
Connect to EXO management shell and MSOL server
Set-ExecutionPolicy Unrestricted -Force
For the variable $O365CREDS, use your Office 365 global administrator credentials (i.e. globaladmin@domainname.onmicrosoft.com).
$O365CREDS = Get-Credential
For the variable $ONPREMCREDS, use your on premise credentials (i.e. AD_DOMAIN_NAME\administrator).
$ONPREMCREDS = Get-Credential
$SESSION = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $O365CREDS -Authentication Basic -AllowRedirection
Import-PSSession $SESSION
Connect-MsolService -Credential $O365CREDS
Move Individual Mailboxes
Run this command to initiate and run the bulk moves…
New-MoveRequest -Identity “EMAIL_ADDRESS” -Remote -RemoteHostName MAIL.DOMAIN.COM -TargetDeliveryDomain DOMAIN .mail.onmicrosoft.com -RemoteCredential $ONPREMCREDS -BadItemLimit 1000
Note: autocomplete migration batch
New-MoveRequest -Identity “EMAIL_ADDRESS ” -Remote -RemoteHostName MAIL.DOMAIN.COM -TargetDeliveryDomain DOMAIN .mail.onmicrosoft.com -RemoteCredential $ONPREMCREDS -BadItemLimit 1000 -BatchName “BATCH_NAME “
Note: add batch name
New-MoveRequest -Identity “EMAIL_ADDRESS ” -Remote -RemoteHostName MAIL.DOMAIN.COM -TargetDeliveryDomain DOMAIN .mail.onmicrosoft.com -RemoteCredential $ONPREMCREDS -SuspendWhenReadyToComplete -BadItemLimit 1000 -BatchName “BATCH_NAME “
Note: not autocomplete migration batch
Monitor Move Requests
To monitor move requests, run this command…
Get-MigrationUser | Get-MigrationUserStatistics
Get-MoveRequest | Get-MoveRequestStatistics
Once the status turned to AutoSuspended and if your user has new emails coming you may run the Resume-MoveRequest
for the user or if you want to stop the move request you can user the Suspend-MoveRequest cmdlets
Suspend-MoveRequest -Identity “EMAIL_ADDRESS “
Resume-MoveRequest -Identity “EMAIL_ADDRESS “
*using Resume-MoveRequest, the batch will be autocompleted hence the user will now be an O365 mailbox
Resume-MoveRequest -Identity “EMAIL_ADDRESS ” -SuspendWhenReadyToComplete
Other statistics cmdlets:
Get-MigrationUserStatistics -Identity davidp@corp.contoso.com -IncludeReport | FL Status,Error,Report
Get-MigrationUser | Get-MigrationUserStatistics -IncludeReport | FL Status,Error,Report
Get-MoveRequest | Get-MoveRequestStatistics | FL identity, percentcomplete
Get-moverequest | get-moverequeststatistics | Where-Object {$_.PercentComplete -lt 100} | FL identity, percentcomplete
Get-MoveRequestStatistics -Identity user@domain.com -IncludeReport | Export-CSV C:\MRStats.csv