Importing PST files into an Exchange mailbox using PowerShell or Outlook

PST files are nothing new to IT admins as they have been around for years. But if you are new to Exchange and PST files, what are they? It is a personal storage table that you have attached to Microsoft Outlook and allows you to create folder structures and drag-and-drop email from your mailbox to the PST file. Many use PST files as a backup, and when they get too large, they end up corrupting, or you cannot open Outlook because of errors with the PST file. With many companies moving mail from on-premises servers to the cloud, PST files can be ingested and taken off users’ machines. Mimecast, for example, will send you an encrypted drive that you can copy all the company PST files to, and they then will bring that mail into your archive, so you always have it available. The same goes for if you have a dedicated Exchange Server store that is used for archive mailboxes — they can be imported there or the users can import the PST file to the archive mailbox that will be available to them in Outlook. We will be taking a look at the two methods of importing PST files — with 1) Exchange Management Shell (EMS) and Exchange admin center, and 2) with Outlook. (Be aware that to enable archiving in Exchange, you need an Enterprise client access license (CAL) for the user.)

export mailboxes to PST
Shutterstock

For the two methods of importing PST files we just mentioned, we need to create a shared folder with rights that the Exchange Trusted Subsystem can access the files with no issue. In your environment, it might be a file server, or if you only have a small handful of PST files, you can also create it on your Exchange Server. Or, if you have a dedicated server used only for mail flow, you can create a folder called PST or PSTFiles, which you need to share. Then, under advanced sharing, add the Exchange Trusted Subsystem with full access.

Once you have completed that, you can now copy over the PST files from users’ machines and, since they will most likely have the email address as the PST name, it is easily identifiable. When the copy is done, you have to make a decision on where you want to import the PST files. This can be to the following locations:

  • Target folder in the mailbox
  • To the archive mailbox
  • To the users’ primary mailbox

Before you can perform imports of PST files, you need to ensure that you have the correct permissions in Exchange to do so. By default, the mailbox import-export role does not have any assigned role groups. Once this has been completed, and replication is complete in the environment, you can now proceed with the mailbox imports.

Importing PST files with PowerShell

Here is one of a few PowerShell commands you can run, the first being the target folder.

New-MailboxImportRequest -Mailbox User1 -FilePath \\EX2016A\PSTFiles\User1.pst -TargetRootFolder "PSTImport"
The above command is relatively simple. It imports the PST file from the server EX2016A and adds it to a target folder, “PSTImport.”

The next command you can use is aimed at importing the PST file into the users’ archive mailbox:

New-MailboxImportRequest -Name "User 1 Import" -FilePath \\EX2016A\PSTFiles\User1Archive.pst -Mailbox User1 -IsArchive -IncludeFolders "#Inbox#" -TargetRootFolder "Recovered Files" -Priority High

You can run the last option as a simple import and not need to specify any target folders, and it will import everything, the same command as option one just leave out the -TargetRootFolder command.

Exchange admin center and EMS

In the Exchange admin center, you have a nice GUI interface to do imports from. To get started, open up Exchange admin center, and on the Recipients Tab on the left, click mailboxes on the right. Next to the refresh button, click the three dots (…), and in that menu, click on “Import PST.” The “Import from a .pst file” wizard will open, and here you need to specify the path, which will be \\EX2016A\PSTFiles\User1.pst as an example.

Click Next, and on the next window, you can select the mailbox to import to. You have the option to select the following:

  • Import to this mailbox
  • Import to this mailbox’s archive

Continue with the pages after that, and then click finish.

For the top two options, the Exchange Management Shell and the Exchange admin center, you can use PowerShell to get the status of the imports. Below are a few examples we can use in the Exchange Management Shell:

Get-MailboxImportRequest

The option above will display all the mailbox import requests. This includes mailbox imports that are in a queued, failed, in progress, or completed state.

Get-MailboxImportRequest -Status InProgress -Database MailboxDB1

The above command will get all the import requests that are in progress for database “MailboxDB1.”

Bad item limits

Just as with mailbox moves, you can set the import requests with a bad item limit if they fail to import. To perform this, you can run the following command. (The example below sets the limit to five for User1:

Set-MailboxImportRequest -Identity "User1\MailboxImport" -BadItemLimit 5

Importing PST files with Outlook

autodiscover
Shutterstock

Importing PST files into Outlook is pretty straightforward, but it does cause Outlook to “hang,” so if you plan to use this method, then advise your users to either use OWA for mail or wait till the process completes.

In Outlook, if you click on the menu “File” and then select the option “Open & Export,” you can then select “Import/Export,” which will start the wizard. The default option will be “Import from another program or file,” select this and then click Next.

On the next page, you will select .PST, and then once you click Next, you will be able to browse to the location where the PST file resides, and then you have the option to allow duplicates or not to import.

There you have the options to import PST files. You can also do bulk imports from Exchange as well.

Featured image: Shutterstock

Leave a Comment

Your email address will not be published.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top