Exchange 2013 – Exporting/importing mailboxes to a PST via Powershell



Stop using Outlook to export and/or import PST for your mailboxes. By using the Powershell commands (New-MailboxExportRequest and New-MailboxImportRequest) I have saved much time. And they come with some useful options.

Here some simple and interesting examples:

Simple mailbox export

[PS] C:\> New-MailboxImportRequest -Mailbox "user1" -FilePath "\\MYSERVER\PST\user1.pst"

The path must be an UNC path, a shared folder. After executing the command, an export request is queued:

Name                Mailbox                    Status
----                -------                    ------
MailboxExport1      mydomain.com/Users/user1   Queued

Using the parameter "-Name" it's possible to set the mailbox export request name. Its interesting when lots of requests are launched simultaneously

[PS] C:\> New-MailboxImportRequest -Mailbox "user1" -FilePath "\\MYSERVER\PST\user1.pst" -Name "Export-user1"
Name                Mailbox                    Status
----                -------                    ------
Export-user1        mydomain.com/Users/user1   Queued

If an "access denied" error is returned, see my post Exchange – “Access to the path is denied” – New-MailboxExportRequest

Monitor export requests

List export requests

[PS] C:\> Get-MailboxExportRequest

Name                        Mailbox                                 Status
----                        -------                                 ------
MailboxExport-user1         mydomain.com/Users/User1                Completed
MailboxExport1              mydomain.com/Users/User2                Failed
MailboxExport2              mydomain.com/Users/User3                Queued

List export requests statistics

[PS] C:\> Get-MailboxExportRequest | Get-MailboxExportRequestStatistics

Name                    StatusDetail    SourceAlias    PercentComplete
----                    ------------    -----------    --------------
MailboxExport-user1     Completed       user1          100
MailboxExport2          Failed          user2          99
[PS] C:\> Get-MailboxExportRequest | Get-MailboxExportRequestStatistics | ft Name,BytesTransferred,EstimatedTransferSize

Name                   BytesTransferred                 EstimatedTransferSize
----                   ----------------                 ---------------------
MailboxExport-user1    15.9 GB (17,074,078,285 bytes)   16.79 GB (18,029,608,525 bytes)
MailboxExport2         86.38 GB (92,745,412,876 bytes)  85.57 GB (91,884,280,265 bytes)

Options when exporting

Its possible to export the folders we want:

Export contacts

[PS] C:\> New-MailboxExportRequest -Mailbox "user1" -IncludeFolders “#Contacts#” -ExcludeDumpster -filepath "\\MYSERVER\PST\user1-contacts.pst"

Export calendar

[PS] C:\> New-MailboxExportRequest -Mailbox "user1" -IncludeFolders “#Calendar#” -ExcludeDumpster -filepath "\\MYSERVER\PST\user1-calendar.pst"

Export tasks

[PS] C:\> New-MailboxExportRequest -Mailbox "user1" -IncludeFolders “#Tasks#” -ExcludeDumpster -filepath "\\MYSERVER\PST\user1-tasks.pst"

Or to filter by date/time. For example, to export a mailbox in separated per year PST:

This exports year 2016 and onwards:

[PS] C:\> New-MailboxExportRequest -Mailbox "user1" -ContentFilter {(Received -ge "01/01/2016")} -FilePath "\\MYSERVER\PST\user1-2016.pst"

Only year 2015:

[PS] C:\> New-MailboxExportRequest -Mailbox "user1" -ContentFilter {(Received -ge "01/01/2015") -and (Received -le "12/31/2015")} -FilePath "\\MYSERVER\PST\user1-2015.pst"

Only year 2014:

[PS] C:\> New-MailboxExportRequest -Mailbox "user1" -ContentFilter {(Received -ge "01/01/2014") -and (Received -le "12/31/2014")} -FilePath "\\MYSERVER\PST\user1-2014.pst"

Year 2013 and older:

[PS] C:\> New-MailboxExportRequest -Mailbox "user1" -ContentFilter {(Received -le "12/31/2013")} -FilePath "\\MYSERVER\PST\user1-2013andOlder.pst"

Import PST to mailbox

We can choose to import into the mailbox folders or into a new folder inside the mailbox:

Add the content in the mailbox folders

[PS] C:\> New-MailboxImportRequest -Mailbox "user1" -FilePath "\\MYSERVER\PST\user1.pst"

Add the content in a new mailbox folder

[PS] C:\> New-MailboxImportRequest -Mailbox "user1" -FilePath "\\MYSERVER\PST\user1.pst" -TargetRootFolder "IMPORTED"

Exchange 2013 - Exporting-importing mailboxes to a PST via Powershell_2

This post only shows some useful examples but you can see the official documentation to see all we can do with these commands.

Leave a Reply

Your email address will not be published. Required fields are marked *