Exchange 2010 SP3 bulk email delete

Posted on 2013-09-27
Medium Priority
Last Modified: 2013-10-03
I have an administrator mailbox on my Exchange server where spam goes, so it's loaded with mail and I want to bulk delete alot of it. I had the powershell command once and it worked but I lost it.

I tried this
search-mailbox -Identity administrator -SearchQuery "Received:> $('1/01/2012') and Received:< $('1/31/2012')" -DeleteContent

and it seems like it worked, I got a ResultItemsCount : 2448 ResultItemsSize  : 111.4 MB (116,811,965 bytes)

Yet email from January 2012 is still in the inbox.

I also tried replacing search-mailbox with get-mailbox
get-mailbox -Identity administrator -SearchQuery "Received:> $('1/01/2012') and Received:< $('1/31/2012')" -DeleteContent

This caused an error - A positional parameter cannot be found that accepts argument '-SearchQuery'. blah blah blah

Any ideas? Thanks a lot.
Question by:cb_it
1 Comment
LVL 13

Accepted Solution

lciprianionut earned 2000 total points
ID: 39532366
SearchQuery  is not a parameter to Get-Mailbox and because of this would not work
Taka e alook at this post from Technet Forums maybe it will help you more. Check also on the left side of the page section "Top related threads"

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Here is a method which can be used to help resolve a "Content Index Failed" error on a Microsoft Exchange Server.
Disk errors can be the source of sundry problems for the Exchange server, the most common one being that the database fails to mount.
This video discusses moving either the default database or any database to a new volume.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

621 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