Mailbox Move CMDlets

Exchange Mailbox Move PowerShell Commands

Move the user mailbox to Database DB01

New-MoveRequest -Identity ‘username@example.com’ -TargetDatabase “DB01”

New-MoveRequest -Identity ‘username@example.com’ -TargetDatabase “DB01” -BadItemLimit 100

 Move the bulk users mailbox to Database DB01

 Create CSV file having the email address of the users and name it as “EmailAddress.csv”

ForEach ($User in Get-Content “C:\temp\EmailAddress.csv”){ New-MoveRequest -Identity $user -TargetDatabase “DB01”}

 To suspend specific user Mailbox move request

 Suspend-MoveRequest -Identity ‘username@example.com’

 To suspend all the move request

 Get-MoveRequest -MoveStatus InProgress | Suspend-MoveRequest

Resume Failed Requests

Get-MoveRequest -resultsize unlimited -MoveStatus Failed | Resume-MoveRequest

Get Failed Moves and resume move requests

Get-MoveRequest -resultsize unlimited -MoveStatus Failed | Resume-MoveRequest

Get Autosuspended Moves and resume move requests

Get-MoveRequest -resultsize unlimited -MoveStatus Autosuspended | Resume-MoveRequest

 Mailbox Move Request Reports – Get detailed info for moved mailbox

Get-MoveRequest | Get-MoveRequestStatistics | Select DisplayName, Status, TotalItemSize, TotalMailboxItemCount, PercentComplete, BytesTransferred, ItemsTransferred

 Mailbox Move Request Reports – Calculating the Total Mailbox Size moved

 $total = Get-MoveRequest | Get-MoveRequestStatistics | Measure-Object TotalMailboxSize -Sum | select -expand sum

[Math]::Round($total /1gb,2)

Get a count of all mailboxes in database (per DB)

Get-mailboxdatabase -identity <database name> | Get-Mailbox -resultsize unlimited | Group-Object -Property:Database | FT name,count -AutoSize

Use this command to view how many move requests are in the queue to be moved:

(Get-MoveRequest -MoveStatus Queued).count

Find the number of Move requests that haven’t completed:

(Get-moverequest -resultsize unlimited | Get-moverequeststatistics| where {$_.Status -notlike “completed*”}).count

Get Good Mailbox Move information for Moves in Progress

Get-moverequest -MoveStatus InProgress | Get-moverequeststatistics| ft DisplayName,PercentComplete,TotalMailboxSize,Bytes* -AutoSize

Get Mailbox Move information by BATCH NUMBER 

Get-moverequest -resultsize unlimited |get-moverequeststatistics |where ({$_.Batchname -like “acct” -and $_.Status -ne “completed”})| sort-object -Property Status -descending | ft Displayname, status, percentcomplete -AutoSize

Get Mailbox Move information by BATCH NUMBER and good information

Get-moverequest | Get-moverequeststatistics| ft DisplayName,batchname,PercentComplete,TotalMailboxSize,Bytestransferredperminute -AutoSize

Get Move Status by Database

Get-moverequest -resultsize unlimited | Get-moverequeststatistics| where {$_.SourceDatabase -like “<source database name>} | Sort-Object -Property PercentComplete -Descending | ft DisplayName, batchname, SourceDatabase,PercentComplete,Status -AutoSize

Get Mailbox Moves that are NOT completed

Get-moverequest -resultsize unlimited | Get-moverequeststatistics| where {$_.Status -notlike “completed*”} | Sort-Object -Property PercentComplete -Descending | ft DisplayName, batchname, SourceDatabase,PercentComplete,Status -AutoSize

Get Mailbox Moves that are Completing

Get-moverequest -resultsize unlimited | Get-moverequeststatistics| where {$_.Status -eq “completing”} | Sort-Object -Property PercentComplete -Descending | ft DisplayName, batchname, SourceDatabase,PercentComplete,Status -AutoSize

Use these commands to get a snapshot of the move throughput for completed moves.

$stats = Get-MoveRequest -MoveStatus Completed | Get-MoveRequestStatistics

$stats | sort totalmailboxsize | ft Alias,{$_.totalmailboxsize.ToMB()},totalinprogressduration -auto

Get Mailbox Moves that are NOT completed by Database

Get-moverequest -resultsize unlimited | Get-moverequeststatistics| where {$_.SourceDatabase -like “<database name> -and $_.Status -ne “completed”} | Sort-Object -Property PercentComplete -Descending | ft DisplayName, batchname, SourceDatabase,PercentComplete,Status -AutoSize

Get Mailbox Moves by Source DB that are pending completion (Auto Completion)

Get-moverequest -resultsize unlimited | Get-moverequeststatistics| where {$_.SourceDatabase -like “<database name> -and $_.Status -eq “autosuspended”} | Sort-Object -Property PercentComplete -Descending | ft DisplayName,PercentComplete,TotalMailboxSize,Bytestransferredperminute ,status -AutoSize

Get Mailbox Moves by Batch that are pending completion (Auto Completion)

Get-moverequest -resultsize unlimited | Get-moverequeststatistics| where {$_.Batchname -like “batch1 -and $_.Status -eq “autosuspended”} | Sort-Object -Property PercentComplete -Descending | ft DisplayName, batchname, SourceDatabase,PercentComplete,Bytestransferredperminute, Status -AutoSize

Get Mailbox Moves that are Suspended

Get-moverequest -resultsize unlimited | Get-moverequeststatistics| where {$_.Status -eq “suspended”} | Sort-Object -Property PercentComplete -Descending | ft DisplayName, batchname, SourceDatabase,PercentComplete,Status -AutoSize

Get Suspended Moves and resume move requests

Get-MoveRequest -resultsize unlimited -MoveStatus Suspended | Resume-MoveRequest

Get Mailbox Moves that are NOT completed and resume them

Get-moverequest -resultsize unlimited | Get-moverequeststatistics| where {$_.Status -ne “completed”} | Resume-MoveRequest

Get Failed Moves and resume move requests

Get-MoveRequest -resultsize unlimited -MoveStatus Failed | Resume-MoveRequest

Get Autosuspended Moves and resume move requests

Get-MoveRequest -resultsize unlimited -MoveStatus Autosuspended | Resume-MoveRequest

Get Completed Moves and Remove move requests

Get-MoveRequest -resultsize unlimited -MoveStatus Completed | Remove-MoveRequest

Get Mailbox Moves that are NOT completed and remove requests

Get-moverequest -resultsize unlimited | Get-moverequeststatistics| where {$_.Status -notlike “completed*”} | Remove-MoveRequest

Remove completed moves by Batch

Get-moverequest -resultsize unlimited |get-moverequeststatistics |where ({$_.Batchname -like “batch1 to batch2 -and $_.Status -eq “completed”})| Remove-MoveRequest

Get-Mailbox Move Statistics with Great Details

Get-MoveRequest -resultsize unlimited| Get-MoveRequestStatistics |Sort-Object CompletionTimeStamp| ft DisplayName, @{Expression={$_.BadItemsEncountered};Label=”Errors”}, @{Expression={$_.PercentComplete};Label=”Percent”}, @{Expression={$_.TotalMailboxSize.ToString().Split(“(“)[0]};Label=”Size”}, @{Expression={$_.totalinprogressduration};label=”Time”},@{Expression={(($_.BytesTransferred/$_.TotalInProgressDuration.TotalMinutes)*60).ToString().Split(“(“)[0]};Label=”Pace/hr”}, @{Expression={$_.MRSServerName.ToString().Split(“.”)[0]};Label=”CAS”}, @{Expression={$_.SourceDatabase.ToString().Split(“\”)[0]};Label=”SourceServer”},SourceDatabase,Status,CompletionTimestamp -auto

Get-Mailbox Move Statistics with Great Details and export

Get-MoveRequest -resultsize unlimited| Get-MoveRequestStatistics |Sort-Object status| ft DisplayName, @{Expression={$_.BadItemsEncountered};Label=”Errors”}, @{Expression={$_.PercentComplete};Label=”Percent”}, @{Expression={$_.TotalMailboxSize.ToString().Split(“(“)[0]};Label=”Size”}, @{Expression={$_.totalinprogressduration};label=”Time”},@{Expression={(($_.BytesTransferred/$_.TotalInProgressDuration.TotalMinutes)*60).ToString().Split(“(“)[0]};Label=”Pace/hr”}, @{Expression={$_.MRSServerName.ToString().Split(“.”)[0]};Label=”CAS”}, @{Expression={$_.SourceDatabase.ToString().Split(“\”)[0]};Label=”SourceServer”},SourceDatabase,Status,CompletionTimestamp -auto > c:\dame.txt

Cancel Move Request for one user

Get-moverequest -Identity ‘user’ | Remove-MoveRequest

Get Move request ERROR status for Failed jobs

Get-moverequest -resultsize unlimited |get-moverequeststatistics |where ({$_.Batchname -like “batch” -and $_.Status -eq “failed”})| sort-object -Property Status -descending | fl DisplayName,batchname,sourcedatabase,targetdatabase,overallduration,mrsservername,totalmailboxsize,totalmailboxitemcount,percentcomplete,failurecode,failuretype,message,failuretimestamp

Get Move request ERROR status for Failed jobs

Get-moverequest -resultsize unlimited |get-moverequeststatistics |where {$_.Status -eq “failed”}| sort-object -Property Status -descending | fl DisplayName,batchname,sourcedatabase,targetdatabase,overallduration,mrsservername,totalmailboxsize,totalmailboxitemcount,percentcomplete,failurecode,failuretype,message,failuretimestamp

Get move details for ongoing moves

Get-moverequest -resultsize unlimited |get-moverequeststatistics |where ({$_.Batchname -like “batch” -and $_.Status -ne “completed”})| sort-object -Property Status -descending | ft DisplayName,batchname,status,targetdatabase,overallduration,mrsservername,percentcomplete -autosize

Find number of moves that haven’t completed

(Get-moverequest -resultsize unlimited |get-moverequeststatistics |where {$_.Batchname -like “batch” -and $_.Status -ne “completed”}).count| ft -autosize

Create a local move request

New-MoveRequest -Identity ‘user@domain.com’ -TargetDatabase <database name>

Create a move request that suspends before completion

New-MoveRequest -Identity ‘user@domain.com’ -TargetDatabase <database name> -SuspendWhenReadyToComplete

Remove \ Clear completed move requests

Get-MoveRequest -resultsize unlimited -MoveStatus queued | Remove-MoveRequest

Resume Failed Requests

Get-MoveRequest -resultsize unlimited -MoveStatus Failed | Resume-MoveRequest

Create a move request processed by a specific server

New-MoveRequest -Identity ‘user@domain.com’ -TargetDatabase <database name> -MRSServer exchsrv1.domain.com

Move a user’s primary mailbox and allow a large bad item limit

New-MoveRequest -Identity ‘user@domain.com’ -TargetDatabase <database name> -BadItemLimit 100 -AcceptLargeDataLoss

Leave a Reply

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