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: http://blogs.technet.com/b/samdrey/archive/2011/02/17/exchange-2010-rbac-issue-mailbox-import-export-gt-new-mailboximportrequest-and-other-management-role-entries-are-missing-not-available.aspx

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:

http://theucguy.net/delete-all-calendar-entries-in-an-exchange-2010-mailbox/

 

 

 

Kommentarer er stengt.

Opprett en gratis blogg eller et nettsted på WordPress.com.

opp ↑

%d bloggere like this: