Link to home
Start Free TrialLog in
Avatar of cb_it
cb_itFlag for United States of America

asked on

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.
ASKER CERTIFIED SOLUTION
Avatar of Ciprian Lozonschi
Ciprian Lozonschi
Flag of Czechia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial