[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 253
  • Last Modified:

how to search multiple exchange databases for a received email and move them to a specific folder

is it possible to search 4 mailbox databases on exchange 2007
for an email from a specific sender
and either delete them all
and give a report how many were deleted
0
dougdog
Asked:
dougdog
  • 3
  • 2
  • 2
  • +1
3 Solutions
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
There is no Search feature like we have in Exchange 2010

http://www.experts-exchange.com/Software/Server_Software/Email_Servers/Exchange/Q_25891756.html
Export-Mailbox "UserMailbox" -Senderkeywords "senderemail" -Deletecontent

http://social.technet.microsoft.com/Forums/en-US/exchangesvradmin/thread/ec8fec31-bafa-42c0-b9ed-cd328747391d

- Rancy
0
 
dougdogAuthor Commented:
so what would be the exact command i would need to search all databases for an email sent from sender@yahoo.co.
and move them into a folder called recall on my mailbox
0
 
dougdogAuthor Commented:
or if that cant be done just delete all emails from the sender
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
Get-Mailbox -ResultSize Unlimited | Export-Mailbox -Senderkeywords "senderemail" -Deletecontent

just check if this helps

- Rancy
0
 
SubsunCommented:
0
 
dougdogAuthor Commented:
will this search mailboxes on 2007 and 2010
I was around 80% on 2007

and 20% on 2010

also would this command be safe to run
I was a little worries when it started saying moving and deleting

Get-Mailbox | Export-Mailbox -SubjectKeywords "movinghouse" -DeleteContent
0
 
DonYoungSr. Enterprise ArchitectCommented:
I've used the following script to do that:

$s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://ServerName/PowerShell/ -Authentication Kerberos
Import-PSSession $s
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -erroraction SilentlyContinue
$lines = Get-Content "c:\TEMP\removal.txt" #text file of mailboxes
foreach ($line in $lines) {
	Search-Mailbox -identity $line -SearchQuery Subject:'text_to_find1'-DeleteContent -Force:$True 
	Search-Mailbox -identity $line -SearchQuery Subject:'text_to_find2'-DeleteContent -Force:$True 
	}

Open in new window

0
 
SubsunCommented:
Export-Mailbox command is supported in Exchange 2007 and Search-Mailbox for Exchange 2010.

For example, if you want to delete a specific mail with sender address subsun@test.com with subject line ”I am back”, then you can use the following command. The command will move the emails to TargetMailbox specified in command (TempMailbox folder To Delete) and then delete the specified content from the user mailboxes.

You may also use -StartDate & -EndDate parameters to specify the dates which you want to search email (to narrow down the search).

Example will search for the specified email on server EXCH.
Get-Mailbox -Server EXCH | Export-Mailbox -TargetMailbox TempMailbox -TargetFolder ”To Delete” -SenderKeywords subsun@test.com -SubjectKeywords ”I am back” –StartDate “12/30/10" –EndDate “12/31/10" –DeleteContent –MaxThreads 10

Open in new window

0

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now