Remove all messages on Exchange Mailbox

Posted on 2013-01-20
Medium Priority
Last Modified: 2013-01-21
After exporting the mails for a mailbox in Exchange 2007, what shell command can be used to clean up all the message for the mailbox ?


export-mailbox -identity "john" -PSTFolderPath c:\temp\Exchange
Question by:AXISHK
  • 2
LVL 10

Expert Comment

ID: 38799889
Use Search-mailbox with the -deletecontent switch:

Author Comment

ID: 38799897
Search-Mailbox -Identity "test" -SearchQuery -DeleteContent

'Search-Mailbox" is not recognized as a cmdlet, function, opperable program or script file.

Any idea ? We are running Exchange 2007. Tks
LVL 10

Accepted Solution

joelsplace earned 1200 total points
ID: 38799903
I didn't realize that doesn't work on pre 2010.
This should:
Get-content c:\11MailboxesList.txt | Get-mailbox | Export-Mailbox -DeleteContent
LVL 15

Assisted Solution

Rajkumar-MCITP earned 800 total points
ID: 38800774
export-mailbox -identity "john" -PSTFolderPath c:\temp\Exchange -Deletecontent

Featured Post

Free tool for managing users' photos in Office 365

Easily upload multiple users’ photos to Office 365. Manage them with an intuitive GUI and use handy built-in cropping and resizing options. Link photos with users based on Azure AD attributes. Free tool!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

The Exchange database may sometimes fail to mount owing to various technical reasons. A dismounted EDB file can be the source of many Exchange errors including mailbox inaccessibility for users. Resolving the root cause of mounting problems becomes …
Configure external lookups on for external mail flow on Exchange 2013 and Exchange 2016.
In this video I will demonstrate how to set up Nine, which I now consider the best alternative email app to Touchdown.
To export Lotus Notes to Outlook PST or Exchange and Domino Server files to Exchange Server or PST files with ease, go for Kernel for Lotus Notes to Outlook conversion tool. Through the video, you can watch the conversion process. A common user with…

624 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