If the basic commands we just went through are not sufficient when it comes to what data you want to import from the PST file, you can use the “-IncludeFolders” parameter to specify which folder or folders from the PST files should be imported. For instance, if I only want to import the data in the Inbox folder, I would use the following command:
New-MailboxImportRequest -Mailbox HEW -FilePath \\EX02\PSTFileShare\HEW.pst -IncludeFolders “#Inbox#”
I can also specify that content from the PST files should be placed in a new folder (target folder) in the mailbox. This is a good approach if you don’t want items from the PST file to merge with items in the mailbox. To do so we would use this command:
New-MailboxImportRequest -Mailbox HEW -FilePath \\EX02\PSTFileShare\HEW.pst -TargetRootFolder “Date from PST file”
Note:
If the target root folder does not exist, it will be created automatically.
In addition to the above commands, you could also choose to have the request created but in a suspended mode (using the “-suspend” parameter) until you are ready to start it. In addition, you can use the “-ExcludeFolders” parameter instead of the “-IncludeFolders” if that suits the situation better. Moreover, you can exclude the dumpster using the “-ExcludeDumpster” parameter. Also and as mentioned already, you can perform the import via multiple import requests running against the same mailbox.
If you need to import multiple PST files named after the mailbox alias of the mailbox to which they need to be imported, we can use the following command (will import all PST files in the share “PSTFiles” on server “EX02” based on mailbox alias and PST name):
Dir \\EX02\PSTFiles\*.pst | %{ New-MailboxImportRequest -Name PSTImport -BatchName Imports -Mailbox $_.BaseName -FilePath $_.FullName }Figure 6: Importing multiple PST files