Deleting content from individual mailbox Exchange 2013

Hi,

I am trying to reduce individual mailboxes in Exchange 2013 but having trouble deleting content. In Exchange 2007 you could export mail and than delete content....this command does not work in the latest version of Exchange.

I have tried several commands using the Search-mailbox command and it doesn't work yet gives a success once completed but deletes no content and give 0 for ResultItemcount and Resultitemsize.

Any help would be great...

Thanks,
Rob
nick_o78Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

Will SzymkowskiSenior Solution ArchitectCommented:
You are on the right track when you are using "Search-Mailbox". Below is an example right from the Search-Mailbox Help within Powershell. This would be for an individual user.

Search-Mailbox -Identity "April Stewart" -SearchQuery 'Subject:"Your bank statement"' -DeleteContent

Open in new window


The good thing about Exchange 2013 over 2007 is that the content is deleted from the mailbox and does not need to be copied to a PST file or another mailbox before the content is removed from the original source.

Will.
nick_o78Author Commented:
Thanks for that....although I am trying to delete by date and am using the following command :
Search-mailbox -identity "windows" -SearchQuery "Received:<$('2014/12/31')" -deletecontent

It runs successfully....and even has a Success : True yet the resultitemcount and resultitemsize is zero.

But I know there are emails in that mailbox for that data range.

Thanks,
Rob
Will SzymkowskiSenior Solution ArchitectCommented:
When ResultItemCount and ResultitemSize = 0 that means the command did not remove anythnig. The command may have completed successfully, however it did not find anything. Possibly a syntax error.

Try the following..
Search-Mailbox -Identity <mailboxname> -SearchQuery 'Received:<$("12/31/2014")' 

Open in new window


Will.
nick_o78Author Commented:
It appears it doesn't like the $ so should look like 'Received<="2015-05-29"

Thanks for the guidance.

Rob

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
Exchange

From novice to tech pro — start learning today.