Delete all the items in a maibox in Exchange 2013

I imported an .pst into the wrong mailbox (but before I gave the credential to the user..) and with 25.000 emails this was not something I would want to do in Outllok with hang etc…

So how can I do this directly on the Exchange 2013 server? Easy! With a one-line in powershell!

But you have to give your administrator the Mailbox Search role and Mailbox Import Export in the ECP. Look at this wonderful blog on how you do that first:

So how do I delete the content with a one liner?

Search-Mailbox -Identity «name of mailbox» -DeleteContent -Force

What we do is basically doing a search in the mailbox without filtering and delete the results. With this approach you can lso filter certain elements and just delte them.

F.ex if you just want to delete all calendar entries in a mailbox:

Search-Mailbox -Identity «name of mailbox» –SearchQuery kind:meetings –DeleteContent

You can also show the estiates on what would be deleted without actually deleting anything by adding –EstimateResultOnly at the the end:

Search-Mailbox -Identity «name of mailbox» –SearchQuery kind:meetings –DeleteContent –EstimateResultOnly

Fore more specific filter, look at this blog which is also the source for my blog:




Kommentarer er stengt.

Opprett en gratis blogg eller et nettsted på

opp ↑

%d bloggere like this: