Export all mailboxes Exchange 2010

i'm running an Exchange 2010 standaard server and want to export all mails before 31 december 2012 for every user mailbox. The original mail should be delete from the mailbox. Im using below command to test it for one mailbox, but that failed. I get see why. I know that some commands are missing in the commandline, but i'm stucked.

New-MailboxExportRequest -ContentFilter {(Received -lt '12/31/2000') -and (Received -gt '12/31/2012')} -Mailbox "NAMEmb" -Name Jobexport -FilePath \\server\path\file.pst

Open in new window




How can i do the export for All my usermailboxes?
sitproAsked:
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.

sitproAuthor Commented:
Also i need to export or delete all mail with specific text (exact match, example:  "this need to be found" ) in the body in this timerange.
0
foxconCommented:
How to Export All the Mailboxes using a Specified date

Step 1:

Open Exchange Management Shell

$Export = Get-Mailbox
(Saving to a Variable)

 

 

Step 2:

 

Specifying lesser than (lt) 01-01-2012

$Export|%{$_|New-MailboxExportRequest -ContentFilter {(Received -lt "01/01-2012")} -FilePath file://servername/pst/$($_.alias).pst}
0
sitproAuthor Commented:
Hi Foxcon,

commandline works not with your filepath. It works with: FilePath \\servername\pst/$($_.alias).pst}

Two questions:

1. whats the option to delete the original mails in the mailbox after this export?
2. whats the commandline to do the same but with specific text (exact match, example:  "this need to be found" ) in the body. With and a sperate command without the timerange?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

foxconCommented:
Hi Sitpro

According to MS: -

[-ContentKeywords <String[]>] should do the trick.
0
foxconCommented:
On point 1.

[-DeleteContent <SwitchParameter>]

However, I would be tempted to export mailboxes, confirm your exports and then re run script to delete once exported.
0
sitproAuthor Commented:
when using this command:
$Export|%{$_|New-MailboxExportRequest -ContentFilter {(Received -lt "01/01-2010")} -FilePath \\serverpath\share\$($_.alias).pst} -DeleteContent

i get this error:
ForEach-Object : Cannot bind parameter 'Process'. Cannot convert the "-DeleteContent" value of type "System.String" to type "System.Management.Automation.ScriptBlock".

I would be very pleased if you can give me the full working command. I not familiar enough with the powershell options.
0
foxconCommented:
You can use the Search-Mailbox cmdlet to search and delete messages from a mailbox.

To search and delete messages in one step, run the Search-Mailbox cmdlet with the DeleteContent switch. However, when you do this, you can't preview search results or generate a log of messages that will be returned by the search, and you may inadvertently delete messages that you didn't intend to. To preview a log of the messages found in the search before they're deleted, run the Search-Mailbox cmdlet with the LogOnly switch.

As an additional safeguard, you can first copy the messages to another mailbox by using the TargetMailbox and TargetFolder parameters. By doing this, you retain a copy of the deleted messages in case you need to access them again.

Search-Mailbox -Identity "April Stewart" -SearchQuery "Subject:'Your bank statement'" -TargetMailbox "administrator" -TargetFolder "SearchAndDeleteLog" -LogOnly -LogLevel Full

Search-Mailbox -Identity "April Stewart" -SearchQuery "Subject:'Your bank statement'" -DeleteContent

However with Search-Mailbox you need to use the Advanced Query Syntax (AQS) rather than -ContentFilter
0
sitproAuthor Commented:
With below cmdlet I exported all mailbox data between the specific date to pst.

But does this work for all received data in ALL subfolder?
Do i need to change "Received" to "sent" to do it for the sent folder?

$Export|%{$_|New-MailboxExportRequest -ContentFilter {(Received -lt "01/01-2006")} -FilePath \\server\share\$($_.alias).pst}

Open in new window



 But still i need to know the syntax for the following:

- remove data in specific period for ALL exchange users for ALL folder (inbox, subs, sent, etc.)
the cmdlet you write does only do it for 1 specific mailbox and not between a specific timeperiod.

- remove data in specific period AND ALSO specific words for ALL exchange users for ALL folder (inbox, subs, sent, etc.)
0
sitproAuthor Commented:
It wasn't possible to do it with de Exchange shell. Therefor i use this tool: http://www.lucid8.com/product/digiscope.asp
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
sitproAuthor Commented:
.
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.