Solved

Remove all email messages from a specific mailbox via Powershell

Posted on 2013-05-19
5
501 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 42

Expert Comment

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

Open in new window

0
 
LVL 42

Expert Comment

by:sedgwick
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:
sedgwick earned 500 total points
ID: 39180135
did u run this:
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010

Open in new window

0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
Unified and professional email signatures help maintain a consistent company brand image to the outside world. This article shows how to create an email signature in Exchange Server 2010 using a transport rule and how to overcome native limitations …
In this video we show how to create an email address policy 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…
how to add IIS SMTP to handle application/Scanner relays into office 365.
Suggested Courses

617 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