Solved

Export all mailboxes Exchange 2010

Posted on 2014-10-01
10
96 Views
Last Modified: 2014-10-15
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?
0
Comment
Question by:sitpro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
10 Comments
 

Author Comment

by:sitpro
ID: 40354021
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
 
LVL 1

Expert Comment

by:foxcon
ID: 40354053
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
 

Author Comment

by:sitpro
ID: 40354318
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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 1

Expert Comment

by:foxcon
ID: 40354353
Hi Sitpro

According to MS: -

[-ContentKeywords <String[]>] should do the trick.
0
 
LVL 1

Expert Comment

by:foxcon
ID: 40354356
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
 

Author Comment

by:sitpro
ID: 40354404
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
 
LVL 1

Expert Comment

by:foxcon
ID: 40354424
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
 

Author Comment

by:sitpro
ID: 40355392
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
 

Accepted Solution

by:
sitpro earned 0 total points
ID: 40372926
It wasn't possible to do it with de Exchange shell. Therefor i use this tool: http://www.lucid8.com/product/digiscope.asp
0
 

Author Closing Comment

by:sitpro
ID: 40381716
.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
A list of top three free exchange EDB viewers that helps the user to extract a mailbox from an unmounted .edb file and get a clear preview of all emails & other items with just a single click on mailboxes.
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
This video discusses moving either the default database or any database to a new volume.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question