Solved

Remove all email messages from a specific mailbox via Powershell

Posted on 2013-05-19
5
496 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: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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this video we show how to create a User Mailbox 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 Recipients >> Mailb…
In this video we show how to create a mailbox database 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 Servers >> Data…

759 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now