Exchange 2010 SP3 bulk email delete

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.
cb_itAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

lciprianionutCommented:
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"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Switches / Hubs

From novice to tech pro — start learning today.