Link to home
Start Free TrialLog in
Avatar of Malli Boppe
Malli BoppeFlag for Australia

asked on

delete all mail for all users in exchange 2010

Is their a way to delete all mail for all users in exchange 2010 SP1. The reason for this is as test I have imported all the mail (through PSTs) from our current domain to the new domain. So would like to delete all the mail and start again .
Avatar of Hendrik Wiese
Hendrik Wiese
Flag of South Africa image

Create a backup mailbox and run the following replacing "MyBackupMailbox" with your backup mailbox name:

Get-Mailbox -Server Server1 -ResultSize Unlimited | Export-Mailbox -IncludeFolders "\Inbox" -StartDate "09/07/2010" -EndDate "09/09/2010" -DeleteContent -TargetMailbox MyBackupMailbox -TargetFolder DeleteMsgs -Confirm:$false

Open in new window

Or you could try this as well (I have not tested it though):

Get-Mailbox | Export-Mailbox -DeleteContent

Open in new window

Avatar of Malli Boppe

ASKER

Export-mailbox has been removed from exchange 2010 SP1.
Have you tried, again have not tested it, but let me know if it works?:

Get-Mailbox -Server “your server” | Search-Mailbox -DeleteContent

Open in new window

If ou dont need the public databse content then you can simply delete the DB file.. :)
ASKER CERTIFIED SOLUTION
Avatar of Akhater
Akhater
Flag of Lebanon image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the points