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!!
eshiramAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

becraigCommented:
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.
0
eshiramAuthor Commented:
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!
0
becraigCommented:
If you notice in step two:
$Export|%{$_|New-MailboxExportRequest -InclueFolders "#Sentitems#,"#inbox#" -FilePath file://servername/pst/$($_.alias).pst}

You specify the folders you need with the -InclueFolders flag.
More info on the flags for this command:
http://technet.microsoft.com/en-us/library/ff607299%28v=exchg.150%29.aspx

I hope this answers your question.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
eshiramAuthor Commented:
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
0
becraigCommented:
you just pipe the get-mailbox command into it


get-mailbox | % {
New-MailboxExportRequest -ContentFilter {(Received -lt "12/31/2013") -or (Sent -lt "12/31/2013")} -Mailbox $_  -FilePath \\hostname\PSTExport\$_.pst
}

Open in new window


get-mailbox | % {
Search-Mailbox -Identity  $_ -SearchQuery “received:<12/31/2013 and sent:<12/31/2013" –DeleteContent 
}

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Exchange

From novice to tech pro — start learning today.

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.