Import-Mailbox
Applies to: Exchange Server 2007 SP1, Exchange Server 2007 SP2, Exchange Server 2007 SP3
Use the Import-Mailbox cmdlet to import mailbox data from a .pst file to a mailbox.
The Import-Mailbox cmdlet imports all associated folder messages if they exist in the .pst file. Associated messages contain hidden data that has information about rules, views, and forms.
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>] [-IncludeFolders <MapiFolderPath[]>] [-Locale <CultureInfo>] [-MaxThreads <Int32>] [-RecipientKeywords <String[]>] [-ReportFile <LocalLongFullPath>] [-SenderKeywords <String[]>] [-StartDate <DateTime>] [-SubjectKeywords <String[]>] [-ValidateOnly <SwitchParameter>] [-WhatIf [<SwitchParameter>]]
Detailed Description
To run the Import-Mailbox cmdlet, the account that you use must be delegated the following:
Exchange Server Administrator role and local Administrators group for the target server
Full access to the target mailbox
For more information about permissions, delegating roles, and the rights that are required to administer Microsoft Exchange Server 2007, see Permission Considerations.
To grant full access to a mailbox, use the Add-MailboxPermission cmdlet and specify FullAccess for the AccessRights parameter.
To import data from a .pst file, you must run the Import-Mailbox cmdlet from a 32-bit computer that has the following installed:
32-bit version of the Exchange management tools
Microsoft Office Outlook 2003 Service Pack 2 (SP2) or later versions
For Exchange 2007 management tools 32-bit download information, see Microsoft Exchange Server 2007 Management Tools (32-Bit).
You can use the Import-Mailbox cmdlet to import data to either a folder or a .pst file. The source and target mailboxes must be on a computer that is running one of the following versions of Exchange:
Exchange Server 2007
Exchange Server 2003 Service Pack 2 (SP2) or later versions
Exchange 2000 Server Service Pack 3 (SP3) or later versions
To import data from a .pst file to a mailbox on any other version of Exchange, you must use the Microsoft Exchange Server Mailbox Merge Wizard (ExMerge.exe).
You cannot import data by using the Import-Mailbox cmdlet from a .pst file to a mailbox that is in a recovery storage group (RSG).
You cannot import data by using the Import-Mailbox cmdlet into a public folder database.
Note
You do not have to configure a MAPI profile when you use the Import-Mailbox cmdlet.
For more information about using the Import-Mailbox cmdlet, see How to Import Mailbox Data
Parameters
Parameter | Required | Type | Description |
---|---|---|---|
PSTFolderPath |
Required |
Microsoft.Exchange.Data.LongPath |
The PSTFolderPath parameter specifies the path of the .pst file from which data will be 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 will import 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 import 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. |
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 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 import. If the command finds a keyword that you specify in the message body or in the attachment content, it will import those messages. |
EndDate |
Optional |
System.DateTime |
The EndDate parameter specifies the end date for filtering content that will be imported to the target mailbox. Only items in the .pst file whose date is prior to or the same as the end date will be imported. 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 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:
If the Get-Mailbox command object is piped, this parameter is not required. |
IncludeFolders |
Optional |
Microsoft.Exchange.Data.Mapi.MapiFolderPath[] |
The IncludeFolders parameter specifies the list of folders to include during the import. |
Locale |
Optional |
System.Globalization.CultureInfo |
The Locale parameter specifies the locale of messages to import. The command will import 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 will import those messages. |
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 keywords of the content to include in the import. If the command finds a keyword that you specify in the sender, it will import those messages. |
StartDate |
Optional |
System.DateTime |
The StartDate parameter specifies the start date for filtering content that will be imported to the target mailbox. Only items in the .pst file whose date is later than the start date will be imported. 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 .pst file. |
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. Note If you run the Import-Mailbox command with this parameter, the command will not apply any filters to the messages. It will only check if the source and target mailboxes exist. |
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 do not have to specify a value with the WhatIf parameter. |
Input Types
Return Types
Errors
Error | Description |
---|---|
|
Example
The first example shows how to import the data from the file C:\PSTFiles\john.pst to the existing, connected mailbox of john@contoso.com.
The second example shows how to import the data from all the .pst files that are 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 will be imported. For each .pst file, only the messages that were received after 01/01/2007 will be imported into the mailbox.
The third example shows how to import 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 will be imported. Only .pst files whose alias corresponds to a user in the Marketing organizational unit will be imported. If no .pst file exists in C:\PSTFiles for a user in the Marketing organizational unit, you will receive an error.
Import-Mailbox -Identity john@contoso.com -PSTFolderPath C:\PSTFiles\john.pst
Dir C:\PSTFiles | Import-Mailbox -StartDate 01/01/2007
Get-Mailbox -OrganizationalUnit Marketing | Import-Mailbox -PSTFolderPath C:\PSTFiles