Solved

Deleting messages based on subject keywords

Posted on 2014-07-18
5
139 Views
Last Modified: 2014-07-21
I am looking to manage size of inboxes by auto deleting messages that have a certain subject line after say 30 days.
0
Comment
Question by:Brazilee
  • 2
  • 2
5 Comments
 
LVL 28

Expert Comment

by:becraig
ID: 40205769
Get-Mailbox -ResultSize Unlimited | Export-Mailbox -ContentKeywords "<subject line here>" -TargetMailbox MyBackupMailbox -StartDate "06/18/2014" -EndDate "07/18/2014" -TargetFolder '<folder Name>' -DeleteContent

Open in new window

0
 
LVL 7

Accepted Solution

by:
Murali Reddy earned 350 total points
ID: 40205983
There are two disadvantages of using above commad
1- exporting contents to a common mailbox, do you really need it?
2- it is exporting and deleting one month's range (-StartDate "06/18/2014" -EndDate "07/18/2014") emails only.


I'd suggest you use search-mailbox with AQS something like,

Get-Mailbox -ResultSize unlimited | Search-Mailbox -SearchQuery {(subject:<SubjecttoQuery>) AND (Sent:01/01/2000..06/19/2014) AND (Received:01/01/2000..06/19/2014)} -DeleteContent

if you want a copy of it or you want to just log thedetails, use some thing like'

Get-Mailbox -ResultSize unlimited | Search-Mailbox -SearchQuery {(subject:<SubjecttoQuery>) AND (Sent:01/01/2000..06/19/2014) AND (Received:01/01/2000..06/19/2014)} -TargetMailbox Administrator -TargetFolder SearchLogs -LogOnly -LogLevel Full



## I put some old date top have the range cover all the emails olderthan 30 days. you choose accordingly.

First you use -logonly parameter to see if you are getting the exact results and then proceed to delete.
0
 

Author Comment

by:Brazilee
ID: 40206496
Can I use this command to affect the entire company (information store) rather then one mailbox?
0
 
LVL 28

Expert Comment

by:becraig
ID: 40206510
The command I gave you is for all mailboxes.

If you want for a single mailbox you would have to specify the user Identity.

For a specific server specify server.

Some good reading to help you better understand the get-mailbox command:
http://technet.microsoft.com/en-us/library/bb123685%28v=exchg.150%29.aspx
0
 
LVL 7

Expert Comment

by:Murali Reddy
ID: 40206955
Get-mailbox -Resultsize Unlimited | ***** yes, this is for all mailboxes in your organization.

if you want for a specific mailbox
get-mailbox -identity "Mailbox identity" |******
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
In this video we show how to create a Contact 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 Recipients >> Contact ta…
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…

708 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

17 Experts available now in Live!

Get 1:1 Help Now