Skip to main content

Exchange - Backup mailbox ra PST

Exchange 2016, 2013, 2010 mailbox backup by export to PST (PowerShell)

avatar
[Update]: This post was updated on January 24, 2018.
Exchange 2013/2010 mailbox backup by export to PST (PowerShell)
An email organization lives and dies by mailbox backups. Unfortunately, all Microsoft Exchange versions, including Exchange 2016, come with limited brick-level backup capabilities. Basically, the only available granular option is an export to PST files. This can be done via Outlook (obviously), PowerShell and in some cases also via Exchange Management Console / Control Panel. In this article I discuss the options available via PowerShell in: Exchange 2016Exchange 2013 and Exchange 2010.
Note: To export Exchange 2007 mailboxes to PST files use the Export-Mailbox cmdlet. If you are using Exchange Online, consult this article.

Single mailbox export to PST file

Exporting mailbox contents to a PST file is achieved using the MailboxExportRequest cmdlet. It has only 2 obligatory parameters: FilePath – defines the network share path of the PST file to which you want to export the data; and Mailbox – defines the Alias, SMTP address or Display name of the mailbox you will export. Requirements:
  • The user performing the export must be a member of a role group which has the Mailbox Import Export role added. The easiest way of achieving this is running this script:
    New-ManagementRoleAssignment -Role "Mailbox Import Export" -User "<user name or alias>"
    To learn more see the “Add a role to a role group” section of this TechNet article.
  • The location to which you will export the PST file must be a shared folder.

Syntax

Here is an example of a mailbox export request, which backs up an entire mailbox to a PST file:
New-MailboxExportRequest -Mailbox <user> -FilePath \\<server FQDN>\<shared folder name>\<PST name>.pst
Limiting the scope of exported contents is possible using additional parameters, e.g.:

-ContentFilter

Specifies what conditions the contents of a mailbox have to match to be exported into the PST file. The conditions are provided in the form of standard PowerShell logical clauses with several item properties available for filtering (wildcards are supported). Example of a script that exports items received prior to 2013-01-01 with subjects beginning with fwd:
New-MailboxExportRequest -Mailbox <user> -ContentFilter {(Received -lt '01/01/2013') -and (Subject -like 'fwd*')} -FilePath \\<server FQDN>\<shared folder name>\<PST name>.pst

-ExcludeFolders and -IncludeFolders

Just what it sounds like. You can choose from all Exchange mailbox folders. There are also two interesting features available:
  • The capability to filter personal folders located under root folders using the <FolderName>/* syntax.
  • The capability to filter well known Exchange mailbox folders regardless of their name in a local language using the #<FolderName>#/* syntax.
Here is an example of a script that exports only the Inbox and Sent Items folders:
New-MailboxExportRequest -IncludeFolders "#Inbox#/*","#SentItems#" -Mailbox <user> -FilePath \\<server FQDN>\<shared folder name>\<PST name>.pst

-IsArchive

A switch parameter, which defines the archive as the only source of the export. Example:
New-MailboxExportRequest -Mailbox <user> -IsArchive -FilePath \\<server FQDN>\<shared folder name>\<PST name>.pst

-Name

Sets the name of an export request. Useful for tracking or if you want to set more than 10 export requests per a single mailbox. This is because by default Exchange assigns only 10 consecutive names to export requests related to a single mailbox (starting with MailboxExport through MailboxExport9) and then stops. To proceed when all 10 default export request names have been taken, you have to either flush your export requests or start assigning your own names using the Name parameter. Example:
New-MailboxExportRequest -Name <unique name> -Mailbox <user> -IsArchive -FilePath \\<server FQDN>\<shared folder name>\<PST name>.pst

Additional information

A single MailboxExportRequest script can, of course, contain multiple parameters, including ones I didn’t mention. For a full list of available parameters, as well as syntax information and other details, consult the link below. TechNet: single mailbox exports to PST details

Bulk mailbox export to PST file


The requirements here are identical as in the case of single mailbox exports:
  • The user performing the export must be a member of a role group which has the Mailbox Import Export role added (see previous section for more).
  • The location to which you will export the PST file must be a shared folder.

Method 1

Save all mailboxes to a variable (in my case it’s AllMailboxes):
$AllMailboxes = Get-Mailbox
Export all mailboxes to PST files with names based on mailbox aliases (to use a different mailbox property replace the phrase “Alias” with its name):
$AllMailboxes|%{$_|New-MailboxExportRequest -FilePath \\<server FQDN>\<shared folder name>\$($_.Alias).pst}
Additional parameters can be used just as in single mailbox exports (see the first section of this article).

Method 2

Run the below script for the same effect as in Method 1 (the only difference is the use of the foreach command instead of piping):
foreach ($Mailbox in (Get-Mailbox)) { New-MailboxExportRequest -Mailbox $Mailbox -FilePath "\\<server FQDN>\<shared folder name>\$($Mailbox.Alias).pst" }

Limiting the scope of exported mailboxes

You will notice that the methods I describe result in exporting all mailboxes located on your servers. If you want to limit the scope of exported mailboxes, you can do so e.g. using the Get-Mailbox -Filter parameter. Here is an example of a script which lists mailboxes belonging to a security group called export1.
Get-Mailbox -Filter {MemberOfGroup -ne $export1}
NOTE: Using the -Filter parameter with the Get-Mailbox cmdlet results in excluding mailboxes that are defined in the parameter. This is why, to limit the scope of exported mailboxes to e.g. Batch1, you have to use the -Filterparameter to exclude all mailboxes that are not part of Batch1 – hence the use of the -ne (not equals) operator. Adding the -Filter parameter to the Get-Mailbox cmdlets in Method 1 and Method 2 scripts will result in limiting the scope of exported mailboxes. View the full list of filterable Get-Mailbox properties Get-Mailbox cmdlet explained

Mailbox backups to PST file: The bright and the dark side

All in all the drawbacks seem to outweigh the advantages, mainly due to clunky PST handling options and due to the files themselves being rather unstable:
ProsCons
  • Brick-level backups with item filtering capability
  • Support for mass mailbox backups
  • Customizability
  • Available for free
  • Fragility and corruptibility of PST files
  • Limited search capability (only per-PST, upon import)
  • No item preview
  • No central management for backup jobs, storages, etc.
  • Lack of backup statistics
  • Increased execution difficulty due to PowerShell usage
  • Risk of data loss
  • Backup content preview only via Outlook
  • No versioning or incremental backup options (high disk space consumption)
  • Scheduling possible only via Windows Task Manager

Easy brick-level Exchange mailbox backups

You can have all the advantages of a PowerShell assisted mailbox-to-PST backup without its drawbacks. CodeTwo Backup for Exchange allows for secure granular mailbox backups to a stable and easily managed database. The software allows for scheduling multiple simultaneous backup and restore jobs, includes a smart versioning mechanism, full item search and preview, and additionally, allows for archiving storages to PST files as one of 2 available archiving models (learn more…).
Nguồn: 

Nguồn: https://www.codetwo.com/admins-blog/exchange-mailbox-backup-pst-pros-cons/

Comments

Popular posts from this blog

[RAID] SWITCH FROM AHCI TO RAID WITH INTEL C600 CONTROLLER

I personally have used other ways to do this. Manipulating some registry settings in combination with a safe boot before booting normally does the trick as well. This works with both SATA SSD and M.2 NVMe drives and it enables relatively fast switching between back and forth between AHCI and RAID. I have described this method below.  I have also tried the same process used to switch from RAD to AHCI and that works as well. Switch to safe boot Reboot into BIOS Change from AHCI to RAID in the BIOS Boot into safe mode Turn off safe mode and reboot normally again Nothing else and that also did the trick, just like with moving from RAID to AHCI.  So the link above and my step by step below is here for completeness. You have options in case one of them doesn’t work! Step by step AHCI to RAID registry method This procedure I describe below works on Windows 10 1803/1809 and has been tested on Dell Latitude E6220 an XPS 13 9360. Editing the registry is always a little risky if you

ERROR: MAPIEXCEPTIONNOTFOUND: UNABLE TO SYNCHRONIZE MANIFEST.

 Fatal error MapiExceptionNotFound has occurred. Error details: MapiExceptionNotFound: Unable to synchronize manifest. (hr=0x8004010f, ec=-2147221233) This error will appear due to mailbox corruption to eliminate the above error need repair the mailbox  execute the following shell command then clear the move request and initiate again move request   New-MailboxRepairRequest -Mailbox userID -CorruptionType SearchFolder, AggregateCounts, ProvisionedFolder, FolderView

[Hyper-V] - Lỗi không boot vào được sau khi convert máy vật lý sang máy ảo

XỬ LÝ LỖI KHÔNG BOOT ĐƯỢC VÀO MÁY ẢO SAU KHI CONVERT TỪ MÁY VẬT LÝ BẰNG DISK2VHD Sau khi convert server vật lý sang file VHD để import vào Hyper thì khi start máy ảo lên màn hình máy ảo chỉ nhấp nháy con trỏ chuột trên màn hình đen (blinking cursor) NGUYÊN NHÂN Do máy vật lý sử dụng ổ đĩa cài OS được format theo chuẩn GPT (thay vì MBR như truyền thống, tham khảo GPT và MBR ) XỬ LÝ Bước 1: chuyển ổ GPT thành MBR Copy file VHD của ổ đĩa chứa OS về 1 máy tính Windows 8 trở lên Trên máy Windows 8+ click phải chuột lên file VHD vừa copy, chọn lệnh Mount . Lúc này dùng 1 phần mềm miễn phí (vd: Mini Partition Wizard ) để convert ổ đĩa vừa mount từ GPT  -> MBR Sau đó Delete phần Partition dư ra ở phần đầu ổ đĩa được mount (khoảng vài trăm MB) Set " Active " cho ổ đĩa này để là ổ đĩa boot OS Nhấn Apply để phần mềm thực thi tác vụ Sau khi phần mềm làm xong, tắt phần mềm Mini Partition Wizard, vào My Computer chọn eject ổ đĩa đang mount . Copy file VHD vừa đư