Share via


Restore-Mailbox

 

Applies to: Exchange Server 2007 SP1, Exchange Server 2007 SP2, Exchange Server 2007 SP3

Use the Restore-Mailbox cmdlet to extract mailbox content from a database restored to a recovery storage group.

Syntax

restore-Mailbox -Identity <MailboxIdParameter> -RSGDatabase <DatabaseIdParameter> [-AllContentKeywords <String[]>] [-AllowDuplicates <SwitchParameter>] [-AttachmentFilenames <String[]>] [-BadItemLimit <Int32>] [-Confirm [<SwitchParameter>]] [-ContentKeywords <String[]>] [-EndDate <DateTime>] [-ExcludeFolders <MapiFolderPath[]>] [-GlobalCatalog <Fqdn>] [-IncludeFolders <MapiFolderPath[]>] [-Locale <CultureInfo>] [-MaxThreads <Int32>] [-RecipientKeywords <String[]>] [-ReportFile <LocalLongFullPath>] [-SenderKeywords <String[]>] [-StartDate <DateTime>] [-SubjectKeywords <String[]>] [-ValidateOnly <SwitchParameter>] [-WhatIf [<SwitchParameter>]]

restore-Mailbox -Identity <MailboxIdParameter> -RSGDatabase <DatabaseIdParameter> -RSGMailbox <StoreMailboxIdParameter> -TargetFolder <String> [-AllContentKeywords <String[]>] [-AllowDuplicates <SwitchParameter>] [-AttachmentFilenames <String[]>] [-BadItemLimit <Int32>] [-Confirm [<SwitchParameter>]] [-ContentKeywords <String[]>] [-EndDate <DateTime>] [-ExcludeFolders <MapiFolderPath[]>] [-GlobalCatalog <Fqdn>] [-IncludeFolders <MapiFolderPath[]>] [-Locale <CultureInfo>] [-MaxThreads <Int32>] [-RecipientKeywords <String[]>] [-ReportFile <LocalLongFullPath>] [-SenderKeywords <String[]>] [-StartDate <DateTime>] [-SubjectKeywords <String[]>] [-ValidateOnly <SwitchParameter>] [-WhatIf [<SwitchParameter>]]

Detailed Description

The Restore-Mailbox cmdlet copies end-user data from a recovery storage group on any server running Microsoft Exchange Server 2007 to a mailbox on any Exchange 2007 Mailbox server in the same organization that has adequate space and resources to support the mailbox. The Restore-Mailbox cmdlet can only use disconnected mailboxes from a recovery storage group on a server as a source of data, and the cmdlet can only use connected mailboxes as a target for data.

To run the Restore-Mailbox cmdlet, the account you use must be delegated the Exchange Server Administrator role and local Administrators group for both the source and target servers. For more information about permissions, delegating roles, and the rights that are required to administer Exchange 2007, see Permission Considerations.

Parameters

Parameter Required Type Description

Identity

Required

Microsoft.Exchange.Configuration.Tasks.MailboxIdParameter

The Identity parameter specifies the identity of the target mailbox. This parameter is a name or a GUID. If the source mailbox is not identified with the RSGMailbox parameter, it is assumed that the source mailbox has the same mailbox GUID as the target mailbox.

RSGDatabase

Required

Microsoft.Exchange.Configuration.Tasks.DatabaseIdParameter

The RSGDatabase parameter specifies the recovery storage group database from which you are restoring the mailbox. You can use the following values:

  • GUID of the database

  • Database name

  • Server name\database name

  • Server name\storage group\database name

RSGMailbox

Required

Microsoft.Exchange.Configuration.Tasks.StoreMailboxIdParameter

The RSGMailbox parameter specifies the mailbox in the recovery storage group to be used as the source mailbox. This parameter is required if the source mailbox is different from the target mailbox.

TargetFolder

Required

System.String

The TargetFolder parameter specifies the mailbox folder that will be created in the specified mailbox. If the mailbox that is being restored is different from the mailbox in the recovery storage group, the Restore-Mailbox cmdlet will perform a merge.

AllContentKeywords

Optional

System.String[]

The AllContentKeywords parameter specifies the filters for all of the following:

  • Subject

  • Message body

  • Attachment content

This allows an OR search of all these fields. If your search criteria are part of the subject, message body, or attachment content, you will get results.

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.

AttachmentFilenames

Optional

System.String[]

The AttachmentFilenames parameter specifies the filter for the attachment file name. You can use wildcard characters in the string. For example, you can use *.txt to export items that have a .txt extension.

BadItemLimit

Optional

System.Int32

The BadItemLimit parameter specifies the number of corrupted items in a mailbox to skip before the export operation fails.

Confirm

Optional

System.Management.Automation.SwitchParameter

The Confirm parameter causes the command to pause processing and requires the administrator to acknowledge what the command will do before processing continues. The default value is $true.

ContentKeywords

Optional

System.String[]

The ContentKeywords parameter specifies the keyword filters for the message body and content of attachments in the source mailbox.

EndDate

Optional

System.DateTime

The EndDate parameter specifies the end date for filtering content that will be exported from the source mailbox. Only items in the mailbox whose date is prior to the end date will be exported. 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 export. Folders are excluded as they are entered. They are not localized. For example, excluding the calendar folder only excludes the English version of this folder because calendar in other languages is a different word.

GlobalCatalog

Optional

Microsoft.Exchange.Data.Fqdn

The GlobalCatalog parameter specifies the global catalog to use to search for the target mailbox.

IncludeFolders

Optional

Microsoft.Exchange.Data.Mapi.MapiFolderPath[]

The IncludeFolders parameter specifies the list of folders to include during the export. Folders are included as they are entered. They are not localized. For example, including the calendar folder only includes the English version of this folder because calendar in other languages is a different word.

Locale

Optional

System.Globalization.CultureInfo

The Locale parameter specifies the locale setting on a message to restore. With this filter set, only messages of the set locale will be extracted.

MaxThreads

Optional

System.Int32

The MaxThreads parameter specifies the maximum number of threads to use.

RecipientKeywords

Optional

System.String[]

The RecipientKeywords parameter specifies the keyword filters for recipients of items in the source mailbox. This filter will find the search string even if it is part of a word. This is not a whole word search.

ReportFile

Optional

Microsoft.Exchange.Data.LocalLongFullPath

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

SenderKeywords

Optional

System.String[]

The SenderKeywords parameter specifies the keyword filters for senders of items in the source mailbox. This filter will find the search string even if it is part of a word. This is not a whole word search.

StartDate

Optional

System.DateTime

The StartDate parameter specifies the start date. The start date must be before the end date.

SubjectKeywords

Optional

System.String[]

The SubjectKeywords parameter specifies the keyword filters for subjects of items in the source mailbox. This filter will find the search string even if it is part of a word. This is not a whole word search.

TargetFolder

Optional

System.String

The TargetFolder parameter specifies the mailbox folder that will be created on the mailbox specified. This parameter is required if the mailbox being restored is different from the mailbox in the recovery storage group. (For example, the value specified with the Identity parameter is not the same as the value specified with the RSGMailbox parameter.) In this case, the Restore-Mailbox cmdlet will perform a merge. If the values are the same, the TargetFolder parameter is not required.

ValidateOnly

Optional

System.Management.Automation.SwitchParameter

The ValidateOnly parameter instructs the command to simulate the actions that it would take on the object. The default value is $true.

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, the administrator can view what changes would occur without having to apply any of those changes. The default value is $true.

Input Types

Return Types

Errors

Exceptions

Example

In the following example code, the first example restores a mailbox for user Scott from the recovery storage group database MyRSGDatabase.

The second example restores John's mailbox content into Scott's mailbox under the Recovery folder.

The third example restores only the mail with the subject "Meeting," with the message body containing the word "business," and with the message location either in the Inbox or Calendar folder. This example assumes that the mailbox is in English.

The last example bulk restores all the mailboxes in the MyDatabase mailbox database that are also present in the MyRSGDatabase.

Restore-Mailbox -Identity Scott -RSGDatabase MyRSGDatabase
Restore-Mailbox -Identity Scott -RSGDatabase MyRSGDatabase -RSGMailbox John -TargetFolder Recovery
Restore-Mailbox -Identity Scott -RSGDatabase MyRSGDatabase -SubjectKeywords "Meeting" -ContentKeyword "business" -IncludeFolders \Inbox,\Calendar
Get-Mailbox -Database MyDatabase | Restore-Mailbox -RSGDatabase MyRSGDatabase