How to export all mailboxes to PST file on Exchange.

Hi this is my easy way to export all mailboxes to PST on the Exchange servers.

Step1: We have to give our user permission to EXPORT mailboxes.

New-ManagementRoleAssignment -role "Mailbox Import Export" -User OUR_USER

Step2: Please create folder where you want to save PST files.

Step3: Export user names.

Get-mailbox| Select-Object -ExpandProperty Name | Out-File -FilePath "c:\user_list.txt"

Step4: Run script bellow. Please remember to change path where you want save PST files. Very important it has to be UNC path.
foreach ($user in $content)
{
New-MailboxExportRequest -Mailbox $user -FilePath "\\MY-Server\PST\$user Mailbox.pst"
}