Import-Mailbox

[This topic's current status is: Milestone-Ready.]

Applies to: Exchange Server 2010* *Topic Last Modified: 2009-07-12

Use the Import-Mailbox cmdlet to import mailbox data from a .pst file to a mailbox.

Syntax

import-Mailbox [-Identity <MailboxIdParameter>] -PSTFolderPath <LongPath> [-AllContentKeywords <String[]>] [-AllowDuplicates <SwitchParameter>] [-AttachmentFilenames <String[]>] [-BadItemLimit <Int32>] [-Confirm [<SwitchParameter>]] [-ContentKeywords <String[]>] [-EndDate <DateTime>] [-ExcludeFolders <MapiFolderPath[]>] [-GlobalCatalog <Fqdn>] [-IncludeAssociatedMessages <SwitchParameter>] [-IncludeFolders <MapiFolderPath[]>] [-Locale <CultureInfo>] [-MaxThreads <Int32>] [-RecipientKeywords <String[]>] [-SenderKeywords <String[]>] [-StartDate <DateTime>] [-SubjectKeywords <String[]>] [-ValidateOnly <SwitchParameter>] [-WhatIf [<SwitchParameter>]]

Parameters

Parameter Required Type Description

PSTFolderPath

Required

Microsoft.Exchange.Data.LongPath

The PSTFolderPath parameter specifies the path of the .pst file from which data is imported.

AllContentKeywords

Optional

System.String[]

The AllContentKeywords parameter specifies the keywords of the content to include in the import. If the command finds a keyword that you specify in the message body, attachment content, or subject, it imports 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 imports 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 switch specifies whether to copy mail items without checking if they're duplicates of existing items. We recommend that you use the AllowDuplicates parameter with the IncludeFolders parameter.

AttachmentFilenames

Optional

System.String[]

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

BadItemLimit

Optional

System.Int32

The BadItemLimit parameter specifies the number of corrupted items in a .pst file to skip before the import operation fails.

Confirm

Optional

System.Management.Automation.SwitchParameter

The Confirm switch can be used to suppress the confirmation prompt that appears by default when this cmdlet is run. To suppress the confirmation prompt, use the syntax -Confirm:$False. You must include a colon ( : ) in the syntax.

ContentKeywords

Optional

System.String[]

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

EndDate

Optional

System.DateTime

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

ExcludeFolders

Optional

Microsoft.Exchange.Data.MapiFolderPath[]

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

GlobalCatalog

Optional

Microsoft.Exchange.Data.Fqdn

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

Identity

Optional

Microsoft.Exchange.Configuration.Tasks.MailboxIdParameter

The Identity parameter specifies the target mailbox object to which you want to import data. You can use one of the following values:

  • ADObjectID
  • Distinguished name (DN)
  • Legacy Exchange DN
  • GUID
  • Domain\Account name
  • User principal name (UPN)
  • E-mail address
  • Alias

If the Get-Mailbox command object is piped, this parameter isn't required.

IncludeAssociatedMessages

Optional

System.Management.Automation.SwitchParameter

The IncludeAssociatedMessages parameter specifies that associated messages are included in the import. Associated messages contain hidden data with information about rules, views, and forms. By default, associated messages aren't included in an import.

IncludeFolders

Optional

Microsoft.Exchange.Data.MapiFolderPath[]

The IncludeFolders parameter specifies the list of folders to include during the import. When you use this parameter, only folders in the parameter list are included in the import.

Locale

Optional

System.Globalization.CultureInfo

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

MaxThreads

Optional

System.Int32

The MaxThreads parameter specifies the maximum number of threads to use. The default value is 4.

RecipientKeywords

Optional

System.String[]

The RecipientKeywords parameter specifies the keywords of the content to include in the import. If the command finds a keyword that you specify in the recipient list, it imports those messages.

SenderKeywords

Optional

System.String[]

The SenderKeywords parameter specifies the keywords of the content to include in the import. If the command finds a keyword that you specify in the sender, it imports those messages.

StartDate

Optional

System.DateTime

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

SubjectKeywords

Optional

System.String[]

The SubjectKeywords parameter specifies the keyword filters for subjects of items in the .pst file.

ValidateOnly

Optional

System.Management.Automation.SwitchParameter

The ValidateOnly switch tells the cmdlet to evaluate the conditions and requirements necessary to perform the operation and then reports whether the operation will succeed or fail. No changes are made when the ValidateOnly switch is used.

Note

If you run the Import-Mailbox command with this switch, the command doesn't apply any filters to the messages. It only checks whether the source and target mailboxes exist.

WhatIf

Optional

System.Management.Automation.SwitchParameter

The WhatIf switch instructs the command to simulate the actions that it would take on the object. By using the WhatIf switch, 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 switch.

Detailed Description

To import data from a .pst file, you must run the Import-Mailbox cmdlet against a computer running Microsoft Exchange Server 2010 that has the 64-bit version of Microsoft Outlook 2010 installed. We recommend that you run the command on a dedicated Exchange server that doesn't have any mailboxes.

You can import data from a .pst file only to a mailbox that's on an Exchange 2010 server that has the Mailbox server role installed by using the Import-Mailbox cmdlet. To import data from a .pst file to a mailbox on an Exchange Server 2007 server, use the Exchange 2007 version of the Import-Mailbox cmdlet. To import data from a .pst file to a mailbox that's on an Exchange Server 2003 server, you must use the Microsoft Exchange Server Mailbox Merge wizard (ExMerge.exe).

You can't import data by using the Import-Mailbox cmdlet from a .pst file to a mailbox that's in a recovery database.

You can't import data by using the Import-Mailbox cmdlet into a public folder database.

You need to be assigned permissions before you can run this cmdlet. Although all parameters for this cmdlet are listed in this topic, you may not have access to some parameters if they're not included in the permissions assigned to you. To see what permissions you need, see the "Import\Export mailbox" entry in the Mailbox Permissions topic.

Input Types

Return Types

Errors

Error Description

 

Examples

EXAMPLE 1

This example imports the data from the file C:\PSTFiles\john.pst to the existing, connected mailbox of john@contoso.com.

Import-Mailbox -Identity john@contoso.com -PSTFolderPath C:\PSTFiles\john.pst

EXAMPLE 2

This example imports the data from all the .pst files located at C:\PSTFiles into existing mailboxes. The .pst files must be named <alias>.pst, where alias is the alias of the mailbox to which the data is imported. For each .pst file, only the messages that were received after 01/01/2010 are imported into the mailbox.

Dir C:\PSTFiles | Import-Mailbox -StartDate 01/01/2010

EXAMPLE 3

This example imports data from .pst files into mailboxes whose users are in the Marketing organizational unit. The .pst files must be named <alias>.pst, where alias is the alias of the mailbox to which the data is imported. Only .pst files whose alias corresponds to a user in the Marketing organizational unit are imported. If no .pst file exists in C:\PSTFiles for a user in the Marketing organizational unit, you receive an error.

Get-Mailbox -OrganizationalUnit Marketing | Import-Mailbox -PSTFolderPath C:\PSTFiles