Link to home
Create AccountLog in
Avatar of Carl Billington
Carl BillingtonFlag for Australia

asked on

Remove all email messages from a specific mailbox via Powershell

Exchange 2010 SP2 RU6

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

Thanks.
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

Search-Mailbox -Identity "<user name>" -DeleteContent

Open in new window

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
Avatar of gkousikan
gkousikan

Get-Mailbox -ResultSize Unlimited | Export-Mailbox -Senderkeywords "senderemail" –Deletecontent


Export-Mailbox "UserMailbox" -Senderkeywords "senderemail" -Deletecontent
Avatar of Carl Billington

ASKER

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?
ASKER CERTIFIED SOLUTION
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account