Link to home
Start Free TrialLog in
Avatar of Ezra Shiram
Ezra ShiramFlag for United States of America

asked on

Export Mailbox to PST in Exchange 2010 in Bulk

Hello,
I have the task of exporting emails for all mailboxes before a certain date and then to delete those emails from their mailboxes before that date. I first want to have a backup of those emails in a PST file before removing it from their mailboxes completely. For instance, I want to export the entire mailbox of John to a PST from the year 2013 and older. Once that is done, I would like to delete all the emails in his mailbox before 2013 permanently. This needs to be done for everyone on Exchange is there any way to do this in bulk.

I have the two following commands but I want to make sure they do what I need.

The first is to export emails from before a certain date to a PST. However, it says Sent -lt 12/31/2013. But this only looks like its all emails in the Sent folder. I want to export the ENTIRE mailbox before a certain date. The full command that I have is:

New-MailboxExportRequest -ContentFilter {Sent -lt '12/31/2013'} -Mailbox "username" -Name MbxExport -FilePath \\hostname\share\mbx.pst

The second command is to actually remove/delete these emails from the users mailbox. My concern is the same as in the first command, to make sure that the ENTIRE mailbox contents before the specified date is deleted. The command I have is:
Search-Mailbox username@domain.com –SearchQuery "Sent:<$('12/31/2010')" –DeleteContent

Thanks for looking and thanks in advance!!
Avatar of becraig
becraig
Flag of United States of America image

your commands need some tweaking here is a nice step through the export:

http://social.technet.microsoft.com/wiki/contents/articles/13908.bulk-export-mailboxes-to-pst-in-exchange-2010.aspx

Once you are done you can pipe the search-mailbox into delete-content as above.

I am guessing you want "received" and not sent in your command.
Avatar of Ezra Shiram

ASKER

Hi Becraig,
Thanks for the response. In the link you sent me I look at How to Export All the Mailboxes using a Specified date. My question is, does this export the entire mailbox before the specified date or just the items in the Inbox (the items that were received)? I want to export the entire mailbox to PST. Is that possible with one command or do I need to use to commands for sent and received?

Thanks Again!
ASKER CERTIFIED SOLUTION
Avatar of becraig
becraig
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
becraig,
That did answer that question so thanks for the answer. However, I chose another command. Below are the two commands that I will run. How do I make that for bulk processing?

For Exporting:
New-MailboxExportRequest -ContentFilter {(Received -lt "12/31/2013") -or (Sent -lt "12/31/2013")} -Mailbox "networkadmin" -Name MbxExport_Networkadmin -FilePath \\hostname\PSTExport\networkadmin.pst

For Deleting:
Search-Mailbox -Identity “networkadmin” -SearchQuery “received:<12/31/2013 and sent:<12/31/2013" –DeleteContent
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial