Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Remove all email messages from a specific mailbox via Powershell

Posted on 2013-05-19
5
Medium Priority
?
503 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 2000 total points
ID: 39180135
did u run this:
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010

Open in new window

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Know the reasons and solutions to move/import EDB to New Exchange Server. Also, find out how to recover an Exchange .edb file and to restore the file back.
How to deal with a specific error when using the Enable-RemoteMailbox cmdlet to create a mailbox in the cloud-based service, for an existing user in an on-premises Active Directory.
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
To show how to create a transport rule 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 >> Rules tab.:  To cr…

704 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