Thursday, February 19, 2015

Exchange 2010/2013 Mailbox Backup by PST-Export Powershell



Performing the backup of Exchange mailbox database is the most crucial part than any other process executed under Exchange server environment. As Microsoft doesn’t provided any powerful utility for Exchange mailbox backup, So Organizations lose their important data everyday due to lack of mailbox backups. However, there are few manual methods which is successfully performed by Exchange Administrators for all Exchange versions, including 2013, but these methods don’t work always particularly if there are some errors in Exchange mailboxes.


So today I’ll share with you few easiest ways to backup Exchange 2013 and 2010 mailboxes, first is PowerShell scripts method, and another is mailbox backup with a prominent utility(if you’re getting an anonymous error during mailbox export using PowerShell commands.)

Export Single Mailbox PST using PowerShell

Backup of the single mailbox can be easily exported into PST form by running PowerShell script. Exported mailbox to PST file is achieved using the MailboxExportRequest cmdlet which has only two parameters, correspondingly, -FilePath and –Mailbox, where –Mailbox describes Alias and –FilePath defines network path of PST to which you’re exporting the data.

But before exporting mailbox contents, make sure that current user is a member of role group. Simply run the below script to succeeding this- 

New-ManagementRoleAssignment -Role "Mailbox Import Export" -User "<username>"

Also ensure that location must be shared folder where PST file will be exported.

Check the below example of Exchange mailbox export request to backup complete mailbox data to an Outlook PST file.

New-MailboxExportRequest -Mailbox <user> -FilePath \\<server FQDN>\<shared folder name>\<Enter here PST File Name>.pst

You can use content filter parameters to specify the condition on a mailbox have to match to be exported into PST format. 

For example, by running the below script you can export mailbox contents into PST that match the following conditions: 

Subject ‘Re:’,
Received before 05-05-2014

New-MailboxExportRequest -Mailbox <user> -ContentFilter {(Received -lt '05/05/2014') -and (Subject -like 'Re*')} -FilePath \\<server FQDN>\<shared folder name>\<PST name>.pst

You can also define another parameter which describes the archive as the only source of the mailbox export. For example:

New-MailboxExportRequest -Mailbox <username> -IsArchive -FilePath \\<server FQDN>\<Enter the share folder name>\<PST file name>.pst

An Individual/Single MailboxExportRequest script contain multiple parameters including those I mentioned above. You can check the complete list of parameters with their syntax information at TechNet: MailboxExportRequest page.

Export Bulk Mailbox to PST file using PowerShell 

Before run the below scripts, ensure that location must be shared folder where PST file will export, and the user must be a member of a role group which has Mailbox Import Export role added. 

There are two methods for taking the backup of mailboxes in bulk-

Method 1: You can also take the backup of all mailboxes by bulk exporting foreach PowerShell command. For example, run the below command for bulk mailbox export to PST.

foreach ($AllMailboxes in (Get-Mailbox)) { New-MailboxExportRequest -Mailbox $AllMailboxes -FilePath "\\<server FQDN>\<shared folder name>\$($AllMailboxes.Alias).pst" }

Method 2: First save all the mailboxes to a variable. For example, Listofmailboxes is a variable in our case.

$Listofmailboxes = Get-Mailbox

Now export all the mailboxes into PST file with their names based on mailbox aliases.

$Listofmailboxes|%{$_|New-MailboxExportRequest -FilePath \\<server FQDN>\<shared folder name>\$($_.Alias).pst}

However, there is also alternate way to backup Exchange user’s mailboxes without using PowerShell commands. Download Exchange Mailbox to PST Tool, and take the backup of single as well as multiple mailboxes into PST form. And the best part is that you can export mailbox items that match the selective condition as we have done above in Single mailbox export using PowerShell.

No comments:

Post a Comment