Solved

Deleting messages based on subject keywords

Posted on 2014-07-18
5
144 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
[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
  • 2
  • 2
5 Comments
 
LVL 29

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 29

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
In-place Upgrading Dirsync to Azure AD Connect
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…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

726 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