Move mailbox and public folders PS

New Mailbox Database

http://nightfox14.blogspot.nl/2010/03/Exchange-server-2010-create-new-mailbox.html

New-MailboxDatabase -Name "Databasename" -server "MAIL" -EdbFilePath "D:\Exchange Server\V14\Mailbox\DatabaseName\DatabaseName.edb" -LogFolderPath "D:\DatabaseFiles\LogFolder"

Mount-Database "Databasename"

Get-MailboxDatabase -Status | select edbfilepath

EdbFilePath
-----------
D:\Exchange Server\V14\Mailbox\DatabaseName\DatabaseName.edb

 

Get mailboxdatabase and Publicfolder database
Get-MailboxDatabase |fl servername,name,publicfolderdatabase,replicationtype

Check which user mailbox on which database
Get-Mailbox | Sort database, name | Format-Table name, database


Create a local move request

In order to move ONE user, you can use the following from EMS:

New-MoveRequest –Identity "mail@domain.com"-TargetDatabase "NewDB"

Create a batch move request

This example creates a batch move request for all mailboxes on the database DB01 and moves them to the database DB02 with the BatchName parameter value DB01toDB02.

Get-Mailbox -Database DB01 | New-MoveRequest -TargetDatabase DB02 -BatchName "DB01toDB02"


To see the status of a pending move-request you can use the following commands:

Get-MoveRequest

Get-MoveRequestStatistics –Identity "username"

Get-MoveRequest -BatchName "DB01ToDB02"
Get-MoveRequest -BatchName "DB01ToDB02" -MoveStatus CompletedWithWarning

Clear all completed move requests

Get-MoveRequest -MoveStatus Completed | Remove-MoveRequest

https://technet.microsoft.com/nl-nl/library/bb331970(v=SERVERg.141).aspx

This example moves all public folder content from Server01 to Server02.

.\MoveAllReplicas.ps1 -Server Server01 -NewServer Server02

 

Get-PublicFolderStatistics

Get-PublicFolderStatistics -Server "EXCHANGE"

example: Get-PublicFolderItemStatistics -Identity "\Marketing\2013\Pamphlets" | Format-List
https://technet.microsoft.com/en-us/library/aa998663.aspx


important parameters available with the New-MoveRequest

•BatchName - This is a useful parameter that allows you to specify a batch name when moving a number of mailboxes. It is then possible to use this batch name to search for particular mailboxes when using the Get-MoveRequest cmdlet as you will see in part three of this article series.

•IgnoreRuleLimitErrors - If you encounter any rule limit errors when moving a mailbox, you might decide not to move the user’s rules as part of the mailbox move. This parameter allows you to do this. You could, for example, alter the parameters of a move request after it has been submitted to ensure that rules are not processed. We will cover this in part three of this article series.

•MRSServer - Ordinarily, the move request is processed by one of the Client Access Servers within the Active Directory site. To specify a particular Client Access Server, use the MRSServer parameter using the Fully Qualified Domain Name (FQDN) of the Client Access Server.

•SuspendWhenReadyToComplete - This parameter is used to suspend the move request before the mailbox is finally moved to the target database. In other words, all the actual mailbox data is moved but the final move is not completed until the administrator resumes the move request using the Resume-MoveRequest cmdlet. One application of such an approach could be to allow a final approval of a mailbox move. We will look at this parameter in part three of this article series.

Clear the move request of all mailboxes with status Completed
Get-MoveRequest -MoveStatus Completed | Remove-MoveRequest

Stop a pending mailbox move request
Remove-MoveRequest -identity "user@contoso.com"


Failed Move Requests

New-MoveRequest –Identity "Jackyp" -TargetDatabase "MailDB01"

Get-MoveRequestStatistics -Identity "Jackyp"

DisplayName                      Status                    TotalMailboxSize                TotalArchiveSize                PercentComplete
-----------                      ------                    ----------------                ----------------                ---------------
Jacky Peters                      Failed                    410.7 MB (430,601,883 bytes)                                    26

get-moverequest -movestatus Failed|get-moverequeststatistics|select DisplayName,SyncStage,Failure*,Message,PercentComplete,largeitemsencountered,
baditemsencountered

DisplayName           : Jacky Peters
SyncStage             : CopyingMessages
FailureCode           : -2146233088
FailureType           : TooManyBadItemsPermanentException
FailureSide           :
FailureTimestamp      : 13-11-2015 14:45:27
FailureContext        :
Message               : Error: This mailbox exceeded the maximum number of corrupted items that were specified for this move request.
PercentComplete       : 26
largeitemsencountered :
BadItemsEncountered   : 1

Remove-MoveRequest -identity "Jackyp"

New-MoveRequest –Identity "Jackyp" -TargetDatabase "MailDB01" -IgnoreRuleLimitErrors  -BadItemLimit 15

Get-MoveRequestStatistics -Identity "Jackyp"

DisplayName                                Status                    TotalMailboxSize                          TotalArchiveSize                          PercentComplete
-----------                                ------                    ----------------                          ----------------                          ---------------
Jacky Peters                                Completed                 410.7 MB (430,601,880 bytes)                                                        100

No Comments

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *