In Exchange, whether it is Exchange 2010 or 2013 or even 2016, there may come a time when you are required to do an Export of Mailbox to a PST file. This can be for many reasons but sometimes you need information for a specific date Range rather than exporting the entire mailbox.

In this example, we will look at exporting a mailbox or multiple mailboxes to PST files using the -ContentFilter switch and specifying a date range.

We also use a foreach statement so that it will loop through each mailbox specified in a .CSV file, saving you time.

A thing to take note of here is that we use the -or switch when specifying the Sent option, this ensures that mail not only received is exported but sent as well across all folders, here is the script below:

$Users = Get-Content “C:\Users\admin\Desktop\mailboxes.csv”foreach ($User in ($Users)) {New-MailboxExportRequest -Mailbox $User -ContentFilter {(Received -gt ’02/01/2018′) -and (Received -lt ’07/01/2018′) -or (Sent -gt ’02/01/2018′) -and (Sent -lt ’07/01/2018′)} -Filepath “\\Server\PST\Folder1\$($user).pst” }

When the command has been run above, you will see all the mailbox exports start queuing.

In the network share, where we are exporting the mailboxes too, you can see the info as well.

To see how far the exports are, you can run the Get-MailboxExportRequest | Get-MailboxExportRequestStatistics command to get the status as shown above.

Once you done with your mailbox exports, you can then remove the export requests by running the following command:

Get-MailboxExportRequest | Remove-MailboxExportRequest

Hope it helps.

    wpChatIcon

    Discover more from COLLABORATION PRO

    Subscribe now to keep reading and get access to the full archive.

    Continue reading