none
Exchange 2016: Export Multiple Mailbox to PST PowerShell (with specific date range) RRS feed

  • Question

  • Hi,

    How can I export multiple mailbox (with specific date range rather than exporting the entire mailbox) to PST files through PowerShell?

    Thank you,

    Tuesday, April 23, 2019 7:55 AM

Answers

  • Hi,

    You can create a new Text Document, enter the Name of users and save it as .csv file. Here is my .csv file:

    I created a new Text Document, copy and modify the script. Then save it as .ps1 file:

    $Users = Get-Content "C:\Users\administrator.CONTOSO\Desktop\mailboxes.csv" foreach ($User in ($Users)) {New-MailboxExportRequest -Mailbox $User -ContentFilter {(Received -gt '04/15/2019') -and (Received -lt '04/17/2019') -or (Sent -gt '04/15/2019') -and (Sent -lt '04/17/2019')} -Filepath "\\EXCH2016\Users\administrator.CONTOSO\Desktop\export\$($user).pst" }


    Drag the script to EMS to run it:

    I got following .pst files:

    Hope these will help you.

    Regards,

    Lydia Zhou


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Wednesday, April 24, 2019 9:35 AM
    Moderator
  • Hi A-lou,

    Since you have the script to export messages within specific date range, so you only need to import these .pst files. You don't have to set the specific date range again.

    You can use the following command to import different .pst files to different mailboxes:

    Dir \\sharedpath\*.pst | %{ New-MailboxImportRequest -Name <String> -BatchName <String> -Mailbox $_.BaseName -FilePath $_.FullName -TargetRootFolder <folder name>} 


    This command imports all of the .pst files on a shared folder. Each .pst file name is named after a corresponding user's alias. The command creates an import request for all the .pst files and imports the data into the matching mailbox.

    You can check this thread for detailed test results: How to migrate mdaemon mailbox into exchange 2016?

    Regards,

    Lydia Zhou


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Thursday, April 25, 2019 5:48 AM
    Moderator

All replies

  • Here is a thread on how to do with 2016 https://social.technet.microsoft.com/wiki/contents/articles/51689.exchange-2016-export-mail-to-pst-using-a-date-range.aspx

    The above should serve you well, however, if you want a GUI type interface do to this and a lot more check out DigiScope


    Search, Recover, Export Mailboxes, Contacts, Calendars, Tasks from ALL versions of Exchange Offline EDB's, On-Premises Exchange Databases & Office 365. Export, Migrate/Recover into On-Premises Exchange Server, Office 365 with Lucid8's DigiScope

    Tuesday, April 23, 2019 12:34 PM
  • Hi, 

    Troy Werelius provided a good script. You can check the article, and if you need more assistance, please feel free to reply this post directly so we will be notified to follow it up.

    Regards,

    Lydia Zhou


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Wednesday, April 24, 2019 7:23 AM
    Moderator
  • Hi,

    Can you provide the CSV file?

    Thank you,

    Wednesday, April 24, 2019 7:51 AM
  • Hi,

    You can create a new Text Document, enter the Name of users and save it as .csv file. Here is my .csv file:

    I created a new Text Document, copy and modify the script. Then save it as .ps1 file:

    $Users = Get-Content "C:\Users\administrator.CONTOSO\Desktop\mailboxes.csv" foreach ($User in ($Users)) {New-MailboxExportRequest -Mailbox $User -ContentFilter {(Received -gt '04/15/2019') -and (Received -lt '04/17/2019') -or (Sent -gt '04/15/2019') -and (Sent -lt '04/17/2019')} -Filepath "\\EXCH2016\Users\administrator.CONTOSO\Desktop\export\$($user).pst" }


    Drag the script to EMS to run it:

    I got following .pst files:

    Hope these will help you.

    Regards,

    Lydia Zhou


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Wednesday, April 24, 2019 9:35 AM
    Moderator
  • Hi Lydia,

    Thank you very much! 

    How about importing .pst file with specific date range also? Can you also provide the script/instructions?

    A-lou

    Thursday, April 25, 2019 2:48 AM
  • Hi A-lou,

    Since you have the script to export messages within specific date range, so you only need to import these .pst files. You don't have to set the specific date range again.

    You can use the following command to import different .pst files to different mailboxes:

    Dir \\sharedpath\*.pst | %{ New-MailboxImportRequest -Name <String> -BatchName <String> -Mailbox $_.BaseName -FilePath $_.FullName -TargetRootFolder <folder name>} 


    This command imports all of the .pst files on a shared folder. Each .pst file name is named after a corresponding user's alias. The command creates an import request for all the .pst files and imports the data into the matching mailbox.

    You can check this thread for detailed test results: How to migrate mdaemon mailbox into exchange 2016?

    Regards,

    Lydia Zhou


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Thursday, April 25, 2019 5:48 AM
    Moderator
  • Hi,

    Just checking in to see if above information was helpful.

    If the issue has been resolved, don't forget to mark it as answer, this will be easy for other community members to find the useful one. Thanks for your understanding.

    Regards,

    Lydia Zhou


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Tuesday, April 30, 2019 10:17 AM
    Moderator
  • A-lou,

    Would a 3rd party tool be an acceptable alternative to the Microsoft pattern?

    Priasoft has a new tool, Super-ExMerge, that is PowerShell based and can do what you ask.

    An example of the use case you request is shown here:  https://www.priasoft.com/docs/superexmerge-on-line-documentation/common-tasks/exporting-a-mailbox-to-a-pst-file/



    -Eriq VanBibber, CTO, Priasoft Inc.

    Saturday, July 13, 2019 7:50 PM