Wednesday, 11 April 2012 07:20

How to Export (bulk export) Mailboxes to PST, Exchange Server 2010

Written by 

I have been seeing few questions about the mailbox PST export activity on Exchange Server 2010 in forums. In this post, I tried to pen down few helpful command combination of New-MailboxExportRequest in Exchange Server 2010.

Let’s first look at how simply you can export single mailbox PST, followed with some easier filtering option to bulk PST export.

Note – before you proceed, ensure that you have added the PSTAdmin (or any other user, it can be the Exchange Admin also) user to the “Mailbox Import Export

New-ManagementRoleAssignment –Role "Mailbox Import Export" –User PSTAdmin

After this, you will have to re-open the Management Shell to execute the New-MailboxExportRequest successfully.

Also create a network share with read/write permission to this user, it can be create on the server where you run the command. We will use this path for storing the exported PSTs.

Exporting single Mailbox and Archive from Exchange Server 2010,

New-MailboxExportRequest -Mailbox Praveen.Balan -FilePath \\ED-Ex2010\pst\ Praveen.Balan.pst

It looks so simple right, now will it export the personal Archive mailbox as well? The answer is ‘NO’, but if you like to export archive mailbox also, just add –IsArchive parameter at the end of the cmdlet.

New-MailboxExportRequest -Mailbox Praveen.Balan -FilePath \\ED-Ex2010\pst\ArchPraveen.Balan.pst –IsArchive

Exporting Bulk users PST using New-MailboxExportRequest

In many scenarios, we will reach situation where we want to export PST of groups of mailboxes. How do we approach, I have shown couple of such scenario and further can be explored by yourself.

Export PST of mailboxes in a single DATABASE

foreach ($i in (Get-Mailbox -ResultSize Unlimited|Where {$_.Database -eq "Profile-01"})) { New-MailboxExportRequest -Mailbox $i -FilePath "\\ED-Ex2010\pst \$($i.Alias).pst" }

In the cmdlet above ‘Get-Mailbox -ResultSize Unlimited|Where {$_.Database -eq "Profile-01"}’ plays the filtering role, it verify the database parameter of each mailbox in your organization and pass it to the New-MailboxExportRequest cmdlet as input. So if you encounter any issue, please ensure that the filter gives necessary output (run the filter alone in EM Shell).

Export PST of all users

It is farely simple, not much of filtering,

foreach ($i in (Get-Mailbox -ResultSize Unlimited)) { New-MailboxExportRequest -Mailbox $i -FilePath "\\ED-Ex2010\pst \$($i.Alias).pst" }

In the above cmdlet, the filter Get-Mailbox -ResultSize Unlimited will retrieve all mailboxes in your organization.Now you must be think why the "-ResultSize Unlimited", If you have less than 1000 users on your infrastrucuture then you dont need specify the limit. By default the Get commands searches for first 1000 entries. To over come that we add the -ResultSize Unlimited paramater into all commands.

If you want to export Archive mailbox, add the additional parameter (switch) as mentioned earlier. As like above, you can try your own filter for exporting the PST of mailboxes. All you need to do create filtering criteria as I did above and replace it in the shell cmdlet.

Are we done? , few cleanup jobs are pending. When you run the export request it will go for queue and start the export activity. You can verify the status by running the below command,

Get-MailboxExportRequest

If you find all the request status are ‘completed’, you are good to execute the Remove-MailboxExportRequest cmdlet. You can still remove the mailbox request which are completed using the below cmdlet,

Get-MailboxExportRequest | where {$_.status -eq "Completed"} | Remove-MailboxExportRequest

It looks difficult; I think it is really easy. You will get familiar with it once you execute it for couple of times…

Still you end up in issues/errors?, please comment I will help you…

-Praveen