Solved

Export all mailboxes Exchange 2010

Posted on 2014-10-01
10
83 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
  • 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
 
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Resolve Outlook connectivity issues after moving mailbox to new Exchange 2016 server
Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…
This video discusses moving either the default database or any database to a new volume.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now