Applies to: Exchange Server 2007 SP3, Exchange Server 2007 SP2, Exchange Server 2007 SP1
Topic Last Modified: 2009-05-11

Use the Move-Mailbox cmdlet to move mailboxes within your organization or between different organizations.

Syntax

move-Mailbox -Identity <MailboxIdParameter> -TargetDatabase <DatabaseIdParameter> [-BadItemLimit <Int32>] [-Confirm [<SwitchParameter>]] [-DomainController <Fqdn>] [-GlobalCatalog <Fqdn>] [-IgnorePolicyMatch <SwitchParameter>] [-IgnoreRuleLimitErrors <SwitchParameter>] [-MaxThreads <Int32>] [-ReportFile <LocalLongFullPath>] [-UseRusServer <String>] [-ValidateOnly <SwitchParameter>] [-WhatIf [<SwitchParameter>]]
move-Mailbox -Identity <MailboxIdParameter> -TargetDatabase <DatabaseIdParameter> [-AllContentKeywords <String[]>] [-AllowDuplicates <SwitchParameter>] [-AllowMerge <SwitchParameter>] [-AttachmentFilenames <String[]>] [-BadItemLimit <Int32>] [-Confirm [<SwitchParameter>]] [-ContentKeywords <String[]>] [-DomainController <Fqdn>] [-EndDate <DateTime>] [-ExcludeFolders <MapiFolderPath[]>] [-GlobalCatalog <Fqdn>] [-IgnorePolicyMatch <SwitchParameter>] [-IgnoreRuleLimitErrors <SwitchParameter>] [-IncludeFolders <MapiFolderPath[]>] [-Locale <CultureInfo>] [-MaxThreads <Int32>] [-NTAccountOU <OrganizationalUnitIdParameter>] [-PreserveMailboxSizeLimit <SwitchParameter>] [-RecipientKeywords <String[]>] [-ReportFile <LocalLongFullPath>] [-RetryInterval <EnhancedTimeSpan>] [-RetryTimeout <EnhancedTimeSpan>] [-SenderKeywords <String[]>] [-SourceForestCredential <PSCredential>] [-SourceForestGlobalCatalog <Fqdn>] [-SourceMailboxCleanupOptions <None | DeleteSourceMailbox | DeleteSourceNTAccount | MailEnableSourceAccount | CreateSourceContact>] [-StartDate <DateTime>] [-SubjectKeywords <String[]>] [-TargetForestCredential <PSCredential>] [-UseRusServer <String>] [-ValidateOnly <SwitchParameter>] [-WhatIf [<SwitchParameter>]]
move-Mailbox -Identity <MailboxIdParameter> -ConfigurationOnly <SwitchParameter> -TargetDatabase <DatabaseIdParameter> [-BadItemLimit <Int32>] [-Confirm [<SwitchParameter>]] [-DomainController <Fqdn>] [-GlobalCatalog <Fqdn>] [-IgnorePolicyMatch <SwitchParameter>] [-MaxThreads <Int32>] [-ReportFile <LocalLongFullPath>] [-UseRusServer <String>] [-ValidateOnly <SwitchParameter>] [-WhatIf [<SwitchParameter>]]

Parameters

Parameter Required Type Description

ConfigurationOnly

Required

System.Management.Automation.SwitchParameter

The ConfigurationOnly parameter changes the Exchange server location in the Active Directory directory service. Use this parameter to direct the mailbox to a functional server. The mailbox content is not moved. To use this parameter, the destination mailbox must be located on an Exchange 2007 server. The ConfigurationOnly parameter does not let you change an Exchange 2007 mailbox location to an Exchange 2003 or Exchange 2000 mailbox location. Also, we recommend that the source Mailbox server be available when you use this parameter. If the source Mailbox server is not available the operation takes much longer than expected.

Identity

Required

Microsoft.Exchange.Configuration.Tasks.MailboxIdParameter

The Identity parameter specifies the recipient identification of the single mailbox to move. If the Get-Mailbox command is piped, this parameter is not required.

TargetDatabase

Required

Microsoft.Exchange.Configuration.Tasks.DatabaseIdParameter

The TargetDatabase parameter specifies the database to which the mailbox will be moved. If the Get-Mailbox command is piped, this parameter is not required.

If you do not specify the server name, the cmdlet will search for the database on the local server. If you have multiple databases with the same name on the same server, you must specify the storage group.

AllContentKeywords

Optional

System.String[]

The AllContentKeywords parameter specifies the keywords of the content to include in the move. If the command finds a keyword that you specify in the message body, attachment content, or subject, it will export those messages.

Note:
This is different from using both the ContentKeywords and SubjectKeywords parameters. If you use both the ContentKeywords and SubjectKeywords parameters, the command will export only those messages that have both the keyword that you specify for the ContentKeywords parameter in the message body or attachment content, and the keyword you specify for the SubjectKeywords parameter in the subject.

AllowDuplicates

Optional

System.Management.Automation.SwitchParameter

The AllowDuplicates parameter is used to copy mail items without checking if they are duplicates of existing items and without removing duplicate items. We recommend that you use the AllowDuplicates parameter together with the IncludeFolders parameter.

AllowMerge

Optional

System.Management.Automation.SwitchParameter

The AllowMerge parameter specifies the merging of mailboxes if one mailbox already exists. You can use this parameter to move a mailbox between different organizations even if a target mailbox already exists. The contents of the mailbox are merged at the target. This parameter cannot be used if the NTAccountOU parameter is used. If you specify this parameter, the user's rules will not be moved to the target.

AttachmentFilenames

Optional

System.String[]

The AttachmentFilenames parameter specifies the attachments to be included in the move. File names can include any file type and wildcard characters.

BadItemLimit

Optional

System.Int32

The BadItemLimit parameter specifies the number of bad items to skip. Use 0 to not skip bad items. The valid input range for this parameter is 0 to 2,147,483,647.

Confirm

Optional

System.Management.Automation.SwitchParameter

The Confirm parameter causes the command to pause processing and requires you to acknowledge what the command will do before processing continues. You do not have to specify a value with the Confirm parameter.

ContentKeywords

Optional

System.String[]

The ContentKeywords parameter specifies the keywords of the content to include in the move. If the command finds a keyword that you specify in the message body or in the attachment content, it will export those messages.

DomainController

Optional

Microsoft.Exchange.Data.Fqdn

To specify the fully qualified domain name (FQDN) of the domain controller that writes this configuration change to Active Directory, include the DomainController parameter in the command.

EndDate

Optional

System.DateTime

The EndDate parameter specifies the end date for filtering content that will be moved from the source mailbox. Only items in the mailbox whose date is prior to or the same as the end date will be moved. When you enter a specific date, use the short date format that is defined in the Regional Options settings that are configured on the local computer. For example, if your computer is configured to use the short date format mm/dd/yyyy, enter 03/01/2006 to specify March 1, 2006.

ExcludeFolders

Optional

Microsoft.Exchange.Data.Mapi.MapiFolderPath[]

The ExcludeFolders parameter specifies the list of folders to exclude during the move.

GlobalCatalog

Optional

Microsoft.Exchange.Data.Fqdn

The GlobalCatalog parameter specifies the global catalog in which to perform search operations in the target forest.

IgnorePolicyMatch

Optional

System.Management.Automation.SwitchParameter

The IgnorePolicyMatch parameter specifies whether to match recipient policies.

IgnoreRuleLimitErrors

Optional

System.Management.Automation.SwitchParameter

The IgnoreRuleLimitErrors parameter specifies that the command will not move the user's rules to the target Microsoft Exchange Server 2003 or Exchange 2000 Server account. You can specify this parameter to avoid the Microsoft Outlook 32K rules limit. By default, the Move-Mailbox cmdlet will move rules, both in single forest and cross-forest moves.

IncludeFolders

Optional

Microsoft.Exchange.Data.Mapi.MapiFolderPath[]

The IncludeFolders parameter specifies the list of folders to include during the move.

Locale

Optional

System.Globalization.CultureInfo

The Locale parameter specifies the locale of messages to move. The command will move only messages with the locale that you specify.

MaxThreads

Optional

System.Int32

The MaxThreads parameter specifies the maximum number of threads to use. The valid input range for this parameter is 0 to 30.

Note:
The acceptable range of threads to use is determined by the performance of your Exchange organization. We recommend that you perform validation tests to determine an acceptable range for your environment before moving multiple mailboxes concurrently.

NTAccountOU

Optional

Microsoft.Exchange.Configuration.Tasks.OrganizationalUnitIdParameter

The NTAccountOU parameter specifies the organizational unit in which the Microsoft Windows NT accounts are created. This parameter cannot be used if the AllowMerge parameter is used.

PreserveMailboxSizeLimit

Optional

System.Management.Automation.SwitchParameter

The PreserveMailboxSizeLimit parameter specifies whether to apply the size limit options of the source mailbox to the target mailbox.

RecipientKeywords

Optional

System.String[]

The RecipientKeywords parameter specifies recipient e-mail addresses or display names. If the command finds a message with a recipient that is the same as the recipient keyword that you specified, it will move the message.

If the recipient keyword that you specify is the same as a distribution group that is a recipient of a message, the message will be moved. The command does not expand distribution groups to compare the recipient keywords that you specify to the members of a distribution group that is a recipient of a message.

ReportFile

Optional

Microsoft.Exchange.Data.LocalLongFullPath

The ReportFile parameter specifies the path and file name for the XML Report log.

RetryInterval

Optional

Microsoft.Exchange.Data.EnhancedTimeSpan

The RetryInterval parameter specifies the interval for retrieving the move's status from the server.

RetryTimeout

Optional

Microsoft.Exchange.Data.EnhancedTimeSpan

The RetryTimeout parameter specifies the time-out limit for moving a mailbox.

SenderKeywords

Optional

System.String[]

The SenderKeywords parameter specifies sender e-mail addresses or display names. If the command finds a message with a sender that is the same as a sender keyword that you specify, it will move the message.

SourceForestCredential

Optional

System.Management.Automation.PSCredential

The SourceForestCredential parameter specifies the credentials that are used when connecting to the source mailbox.

SourceForestGlobalCatalog

Optional

Microsoft.Exchange.Data.Fqdn

The SourceForestGlobalCatalog parameter specifies the global catalog in which to perform search operations in the source forest.

SourceMailboxCleanupOptions

Optional

Microsoft.Exchange.Management.RecipientTasks.MoveMailboxSourceCleanupType

The SourceMailboxCleanupOptions parameter specifies cleanup options for the source mailbox. This parameter cannot be used if the AllowMerge parameter is used.

The possible values are:

  • DeleteSourceNTAccount. Use to delete the source user account Active Directory object.

  • DeleteSourceMailbox. Use to delete mailbox from the source user account.

  • CreateSourceContact. Use to delete the source user account Active Directory object and create a contact in the source forest that is associated with the mailbox that you are moving to the target forest. You can use this option only if the target mailbox is on an Exchange 2007 server.

  • MailEnableSourceAccount. Use to delete mailbox from source user account and mail-enable the source user account so that it is associated with the mailbox that you are moving to the target forest. You can use this option only if the target mailbox is on an Exchange 2007 server.

StartDate

Optional

System.DateTime

The StartDate parameter specifies the start date for filtering content that will be moved from the source mailbox. Only items in the mailbox whose date is later than the start date will be moved. When you enter a specific date, use the short date format that is defined in the Regional Options settings that are configured on the local computer. For example, if your computer is configured to use the short date format mm/dd/yyyy, enter 03/01/2006 to specify March 1, 2006.

SubjectKeywords

Optional

System.String[]

The SubjectKeywords parameter specifies the keyword filters for subjects of items in the source mailbox.

TargetForestCredential

Optional

System.Management.Automation.PSCredential

The TargetForestCredential parameter specifies the credentials that are used when connecting to the target database.

UseRusServer

Optional

System.String

The UseRusServer parameter instructs the command to use the specified Recipient Update Service server to get and set mailbox and Active Directory user attributes.

ValidateOnly

Optional

System.Management.Automation.SwitchParameter

The ValidateOnly parameter provides the option to validate the import without importing the data. The ValidateOnly parameter validates any prerequisites for the command.

WhatIf

Optional

System.Management.Automation.SwitchParameter

The WhatIf parameter instructs the command to simulate the actions that it would take on the object. By using the WhatIf parameter, you can view what changes would occur without having to apply any of those changes. You don't have to specify a value with the WhatIf parameter.

Detailed Description

You can use the Move-Mailbox cmdlet to perform the following tasks:

  • Move a mailbox between servers in an organization. This move might be useful during hardware or software upgrades.

  • Move a mailbox between servers in different organizations. This move might be useful when organizations merge network infrastructures.

To run the Move-Mailbox cmdlet, the account you use must be delegated the following on both the source and target servers:

  • Exchange Server Administrator role

  • Exchange Recipient Administrator role

  • local Administrators group

Note:
If you are running Microsoft Exchange Server 2007 on a computer that also functions as a domain controller, to move a mailbox to a database on this server the account you use must be delegated the Exchange Server Administrator role, but does not need to be delegated the Exchange Recipient Administrator role.

For more information about permissions, delegating roles, and the rights that are required to administer Exchange 2007, see Permission Considerations.

In Exchange 2007 Service Pack 1 (SP1), if you move a mailbox to which a mobile device is synchronized using Exchange ActiveSync, the sync state of the mailbox is updated automatically during the move. You do not need to perform any additional steps, and the user does not need to again sync the device after a mailbox move.

Input Types

Return Types

Errors

Error Description

  

  

Exceptions

Exceptions Description

  

  

Example

In the first example, the Move-Mailbox command is used to move John Peoples' mailbox (john@contoso.com) to a new mailbox database named NewMailboxDatabase.

The last four examples show how to use the SourceMailboxCleanupOptions parameter when moving mailboxes across forests. In the second example, the Move-Mailbox command is used to move John Peoples' mailbox (john@contoso.com) to a new mailbox database in another forest. In this scenario, the companies Contoso and Fabrikam have merged and mailboxes in the contoso forest are being moved to the fabrikam forest. This example assumes that you have first moved john's user account from the contoso forest to the fabrikam forest using the Active Directory Migration Tool version 3.0 (ADMT v3).

In the third example, you are adding Exchange 2007 Service Pack 1 (SP1) in a new forest and are moving mailboxes to the new server. You plan to use the global address list (GAL) synchronization management agent in Microsoft Identity Integration Server (MIIS) to synchronize users across the forests. However, you are moving many users at once and do not want to wait for the GAL synchronization in MIIS to create contacts so that users in the source forest can send mail to the moved users in the new forest. Instead you use the CreateSourceContact value of SourceMailboxCleanupOptions to create a contact for John in the source forest.

In the fourth example, you are moving from a single forest to a resource forest, and so you move the mailboxes to the new Exchange forest but do not delete the source user account. Instead, you mail-enable the source user account so that the user can receive mail from users in the original forest that you have not yet moved to the new Exchange forest. This is a hybrid forest scenario.

The fifth example is also an example of moving from a single forest to a resource forest. You move the mailboxes to the new Exchange forest without deleting the source user account. In this example, you are moving all the mailboxes to the new Exchange forest and will completely remove Exchange from the source forest. You do not need to mail-enable the source user account because you will remove Exchange from the source forest and will not be in a hybrid forest scenario. Instead, you delete only the source mailbox after it is moved to the new Exchange forest, leaving the source user account.

Copy Code
Move-Mailbox john@contoso.com -TargetDatabase NewMailboxDatabase
Move-Mailbox -TargetDatabase "Target Server\First Storage Group\Mailbox Database" -Identity john -GlobalCatalog GC01.fabrikam.com -SourceForestGlobalCatalog GC02.contoso.com -NTAccountOU "OU=OrgUnit01,DC=fabrikam,DC=com" -SourceForestCredential $SourceCredential -TargetForestCredential $TargetCredential -SourceMailboxCleanupOptions DeleteSourceNTAccount 
Move-Mailbox -TargetDatabase "Target Server\First Storage Group\Mailbox Database" -Identity john -GlobalCatalog GC01.fabrikam.com -SourceForestGlobalCatalog GC02.contoso.com -NTAccountOU "OU=OrgUnit01,DC=fabrikam,DC=com" -SourceForestCredential $SourceCredential -TargetForestCredential $TargetCredential -SourceMailboxCleanupOptions CreateSourceContact
Move-Mailbox -TargetDatabase "Target Server\First Storage Group\Mailbox Database" -Identity john -GlobalCatalog GC01.fabrikam.com -SourceForestGlobalCatalog GC02.contoso.com -NTAccountOU "OU=OrgUnit01,DC=fabrikam,DC=com" -SourceForestCredential $SourceCredential -TargetForestCredential $TargetCredential -SourceMailboxCleanupOptions MailEnableSourceAccount
Move-Mailbox -TargetDatabase "Target Server\First Storage Group\Mailbox Database" -Identity john -GlobalCatalog GC01.fabrikam.com -SourceForestGlobalCatalog GC02.contoso.com -NTAccountOU "OU=OrgUnit01,DC=fabrikam,DC=com" -SourceForestCredential $SourceCredential -TargetForestCredential $TargetCredential -SourceMailboxCleanupOptions DeleteSourceMailbox