Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 102
  • Last Modified:

Exchange 2010 SP3 - Export all mail from date and going forward

Hi EE,

I'm using:

  $a=Get-Mailbox -Identity "*"
  PS C:\Windows\system32> $a |%{
>> $pst=$_.alias+".pst"
>> New-MailboxImportRequest -Mailbox $_.alias -FilePath "\\\smartware\ExchExport\CurrentEmp\$pst"  -BadItemLimit 100 –AcceptLargeDataLoss –AssociatedMessagesCopyOption copy
>> }

No what would I use to export all mail after 11/30/2014?

Tight deadline by manager.  Any info is much appreciated.
  • 2
  • 2
1 Solution
IvanSystem EngineerCommented:
Hi there,

try something like this, for a single user.

New-MailboxExportRequest -Mailbox "user"  -ContentFilter {(Received -gt 11/30/2014)}  -FilePath "\\\smartware\ExchExport\CurrentEmp\user.pst"

I don't have exchange to try, but I think it should work.

New-MailboxExportRequest -ContentFilter {(Received -lt '04/01/2010') -and (Received -gt '03/01/2010')} -Mailbox "xx" -Name xx -FilePath \\ExServer1\Imports\Xxx.pst

You can use -received or -sent
Then -lt for less than
-gt for greater than
-ge for greater than or equal to

You should be able to just swap import for export, drop the bad item limit and then add the content filter in and the code you already have should work
MacGyver80Senior Systems AdministratorAuthor Commented:
Thank you irweazelwalls.

However, I'm trying to export the entire Mail Database.
Ok so easy way is to use a CSC

Get-mailbox database xxx | get-mailbox | fl display name >c:\mailbox.csv

Take that csv and use in second script

$mailbox = import-csv c:\mailbox.csv

For each ($user in $mailbox) {new -mailboxexportrequest $user.displayname -file path \\server\share\$user.displayname.pst -content filter ....... }

File in what you want as content filter and the above should be mostly right (give or take a  typo or dodgy memory)
MacGyver80Senior Systems AdministratorAuthor Commented:
Worked like a charm. Thank you for the guidance.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now