• Outlook User
  • New Outlook app
  • Outlook.com
  • Outlook Mac
  • Outlook & iCloud
  • Developer
  • Microsoft 365 Admin
    • Common Problems
    • Microsoft 365
    • Outlook BCM
    • Utilities & Addins

Using the Export-Mailbox cmdlet

Slipstick Systems

› Exchange Server › Cmdlets › Using the Export-Mailbox cmdlet

Last reviewed on October 9, 2019     4 Comments

An administrator recently asked for help:

We’ve been hit with a miserable phishing attack that has just pounded our mail stores (Exchange 2003) with emails that we would like to remove from everyone’s mailboxes. Do you know of a way of removing all messages with a specific subject line from our Exchange server?

Yes, this is possible. How it's done is different in each version of Exchange:
Exchange 2007 or 2010: Export-Mailbox cmdlet
Exchange 2010: Use the GUI to export from the Exchange Management console
Exchange 2003 or 2007: Exmerge
Additionally, most antivirus and content control software can remove messages from mailboxes.

While you can export to a folder in another mailbox, if you want to export to a pst, you need to install Outlook 2010 64-bit on the Exchange 2010 mailbox server where you are performing the import. For Exchange 2007, you can install the Exchange Management Tools on a 32-bit workstation where Outlook is installed.

With Exchange 2010 you'll need explicit permission for the “Mailbox Import Export” management role. You can set it using this cmdlet:

New-ManagementRoleAssignment –Role "Mailbox Import Export" –User administrator

You'll use the following cmdlet in either Exchange 2007 or 2010 to find and delete items from a mailbox in a specific database. In this example, we are exporting the items to the Phishing folder in the Spam mailbox and deleting them from the source mailbox. The mailbox you export to needs to exist, but the folder will be created if it does not exist. After the cmdlet has finished, you can delete the folder from the mailbox (or delete the pst, if you exported to a pst.)

Get-Mailbox -Database database_name | Export-Mailbox -TargetMailbox Spam -TargetFolder Phishing -SubjectKeywords "phishing subject" -DeleteContent

If you prefer to use Exchange 2010's GUI, open the Exchange Management Console to the mailboxes. Select the mailboxes you want to export from then right click and choose Export Mailbox. Select the target mailbox and enter a name for the target folder then complete the wizard.

Using ExMerge

When you run ExMerge, you'll choose the two-step procedure. When you get to the Options, go to Import Procedure tab and select the option to archive data – this will delete the message from the users mailbox. Then use the Date and Message Details tab to set a date range and enter the subject. When you run ExMerge it will remove all of the messages meeting the conditions you set for the date and message details.

More Information

Exchange 2010 Export-Mailbox cmdlet (TechNet)
How to Export Mailbox Data (Exchange 2007) (TechNet)

Using the Export-Mailbox cmdlet was last modified: October 9th, 2019 by Diane Poremsky
Post Views: 10

Related Posts:

  • Save Sent Items in Shared Mailbox Sent Items folder
  • An administrator set up an Exchange 2010 test server and now he wants
    Moving Exchange 2010 Mailboxes
  • Import Calendar Events into all Mailboxes in Exchange Server
  • Convert an Exchange Mailbox to a Shared Mailbox

About Diane Poremsky

A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

Comments

  1. Bryan says

    April 28, 2017 at 3:05 pm

    Hello: Due to size issues, we need to extract certain attachments (particularly image files) from all mailboxes (Exchange 2010). Any advice or suggestions?
    Thanks!

    Reply
    • Diane Poremsky says

      May 10, 2017 at 12:45 am

      With Exchange 2010, you can use exmerge, but i think it removes the entire message, not just attachments.

      How many mailboxes?

      Reply
  2. Jason Gomez says

    August 9, 2015 at 11:20 am

    Hi Diane. Can the Export-Mailbox cmdlet be used with Exchange Online (Office 365)?

    Reply
    • Diane Poremsky says

      August 15, 2015 at 12:01 am

      No, sorry.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Visit Slipstick Forums.
What's New at Slipstick.com

Latest EMO: Vol. 31 Issue 3

Subscribe to Exchange Messaging Outlook






Support Services

Do you need help setting up Outlook, moving your email to a new computer, migrating or configuring Office 365, or just need some one-on-one assistance?

Our Sponsors

CompanionLink
ReliefJet
  • Popular
  • Latest
  • Week Month All
  • Jetpack plugin with Stats module needs to be enabled.
  • Error Opening iCloud Appointments in Classic Outlook
  • Opt out of Microsoft 365 Companion Apps
  • Mail Templates in Outlook for Windows (and Web)
  • Urban legend: Microsoft Deletes Old Outlook.com Messages
  • Buttons in the New Message Notifications
  • Move Deleted Items to Another Folder Automatically
  • Open Outlook Templates using PowerShell
  • Count and List Folders in Classic Outlook
  • Google Workspace and Outlook with POP Mail
  • Import EML Files into New Outlook
Ajax spinner

Recent Bugs List

Microsoft keeps a running list of issues affecting recently released updates at Fixes or workarounds for recent issues in classic Outlook (Windows).

For new Outlook for Windows: Fixes or workarounds for recent issues in new Outlook for Windows .

Outlook for Mac Recent issues: Fixes or workarounds for recent issues in Outlook for Mac

Outlook.com Recent issues: Fixes or workarounds for recent issues on Outlook.com

Office Update History

Update history for supported Office versions is at Update history for Office

Outlook Suggestions and Feedback

Outlook Feedback covers Outlook as an email client, including Outlook Android, iOS, Mac, and Windows clients, as well as the browser extension (PWA) and Outlook on the web.

Outlook (new) Feedback. Use this for feedback and suggestions for Outlook (new).

Use Outlook.com Feedback for suggestions or feedback about Outlook.com accounts.

Other Microsoft 365 applications and services




New Outlook Articles

Error Opening iCloud Appointments in Classic Outlook

Opt out of Microsoft 365 Companion Apps

Mail Templates in Outlook for Windows (and Web)

Urban legend: Microsoft Deletes Old Outlook.com Messages

Buttons in the New Message Notifications

Move Deleted Items to Another Folder Automatically

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Google Workspace and Outlook with POP Mail

Import EML Files into New Outlook

Newest Code Samples

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Insert Word Document into Email using VBA

Warn Before Deleting a Contact

Use PowerShell to Delete Attachments

Remove RE:, FWD:, and Other Prefixes from Subject Line

Change the Mailing Address Using PowerShell

Categorize @Mentioned Messages

Send an Email When You Open Outlook

Delete Old Calendar Events using VBA

Repair PST

Convert an OST to PST

Repair damaged PST file

Repair large PST File

Remove password from PST

Merge Two Data Files

Sync & Share Outlook Data

  • Share Calendar & Contacts
  • Synchronize two computers
  • Sync Calendar and Contacts Using Outlook.com
  • Sync Outlook & Android Devices
  • Sync Google Calendar with Outlook
  • Access Folders in Other Users Mailboxes

Diane Poremsky [Outlook MVP]

Make a donation

Mail Tools

Sending and Retrieval Tools

Mass Mail Tools

Compose Tools

Duplicate Remover Tools

Mail Tools for Outlook

Online Services

Calendar Tools

Schedule Management

Calendar Printing Tools

Calendar Reminder Tools

Calendar Dates & Data

Time and Billing Tools

Meeting Productivity Tools

Duplicate Remover Tools

Productivity

Productivity Tools

Automatic Message Processing Tools

Special Function Automatic Processing Tools

Housekeeping and Message Management

Task Tools

Project and Business Management Tools

Choosing the Folder to Save a Sent Message In

Run Rules on messages after reading

Help & Suggestions

Submit Outlook Feature Requests

Slipstick Support Services

Buy Microsoft 365 Office Software and Services

Visit Slipstick Forums.

What's New at Slipstick.com

Home | Outlook User | Exchange Administrator | Office 365 | Outlook.com | Outlook Developer
Outlook for Mac | Common Problems | Utilities & Addins | Tutorials
Outlook & iCloud Issues | Outlook Apps
EMO Archives | About Slipstick | Slipstick Forums
Submit New or Updated Outlook and Exchange Server Utilities

Send comments using our Feedback page
Copyright © 2026 Slipstick Systems. All rights reserved.
Slipstick Systems is not affiliated with Microsoft Corporation.