Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So, we had an errant program kick off about 15,000 emails to our users. I have our spam filters now blocking these on the edge until that gets resolved, but now I would like to clean our our users' mailboxes for them. Is there anyway with Exchange 2007 to remove all emails with certain text in the subject line? It would need to be a partial match because the subject changes slightly for each email.

I am trying to do this with Forefront's manual scan job + content filter, but it does not seem to like partial matches on the subject.

share|improve this question
up vote 3 down vote accepted

I haven't used it myself, but the export-mailbox PowerShell command should be what you need using the -Deletecontent option along with the -SubjectKeywords option. Here's the link from MSDN on export-mailbox. I also found this blog post with some good information.


Get-Mailbox | Export-Mailbox -SubjectKeywords “Text to block” -Deletecontent -confirm:$false -whatif (omit -whatif to actually run the command.)

share|improve this answer

use the powershell commands, I don't have a exchange 2007 server I can test this on but I've done this in the past I'll hunt around for the correct scriptlet. tr

share|improve this answer
yep Joe nailed it! – tony roth Mar 25 '10 at 22:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.