Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Remove all email messages from a specific mailbox via Powershell

Posted on 2013-05-19
5
Medium Priority
?
505 Views
Last Modified: 2013-05-20
Exchange 2010 SP2 RU6

Is there a powershell command that would remove all emails from a specific mailbox?

Thanks.
0
Comment
Question by:the_omnific
  • 3
5 Comments
 
LVL 42

Expert Comment

by:Meir Rivkin
ID: 39178350
Search-Mailbox -Identity "<user name>" -DeleteContent

Open in new window

0
 
LVL 42

Expert Comment

by:Meir Rivkin
ID: 39178352
one thing, you must be assigned the "Mailbox import Export" Role when running Search-Mailbox with parameter -DeleteContent:
http://technet.microsoft.com/en-us/library/ee633452.aspx
0
 
LVL 1

Expert Comment

by:gkousikan
ID: 39180098
Get-Mailbox -ResultSize Unlimited | Export-Mailbox -Senderkeywords "senderemail" –Deletecontent


Export-Mailbox "UserMailbox" -Senderkeywords "senderemail" -Deletecontent
0
 
LVL 1

Author Comment

by:the_omnific
ID: 39180125
Correct, I need to run: New-ManagementRoleAssignment -Name "Import Export_Enterprise Support" -SecurityGroup "Organization Management" -Role "Mailbox Import Export"

I have done this but it still does not recognize: Search-Mailbox command.

Any ideaS?
0
 
LVL 42

Accepted Solution

by:
Meir Rivkin earned 2000 total points
ID: 39180135
did u run this:
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010

Open in new window

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
In this video we show how to create an Accepted Domain in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Ac…
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question