Applies to: Exchange Server 2007 SP3, Exchange Server 2007 SP2, Exchange Server 2007 SP1, Exchange Server 2007
Topic Last Modified: 2007-01-02

This topic explains how to use the Exchange Management Shell to search for specific message content, and then either review or delete the messages that contain the content. Using the Export-Mailbox cmdlet, you can specify the message content for which to search within a mailbox or database, and then copy those messages to a target mailbox for the purposes of review or deletion.

Note:
Exchange Search functionality is used to search for content across mailboxes and databases. For more information about Exchange Search, see Managing Exchange Search.

There are several scenarios where you may need to search for message content across mailboxes and databases. For example, if you detect that specific messages contain viruses, you may want a report that lists which users have these messages in their mailbox. You can select to simply create the report for further investigation. In this case, you would use the Export-Mailbox cmdlet to copy these messages to a target mailbox, from which you can create the report. However, you may want to remove these messages from the mailboxes, and then automatically delete them. In this case, you would use the Export-Mailbox cmdlet in conjunction with the DeleteContent parameter.

Before You Begin

To run the Export-Mailbox cmdlet, the account you use must be delegated the following:

  • Exchange Server Administrator role and local Administrators group for the source server and the target server

To run the Get-Mailbox cmdlet, the account you use must be delegated the following:

  • Exchange Recipient Administrator role

For more information about permissions, delegating roles, and the rights that are required to administer Microsoft Exchange Server 2007, see Permission Considerations.

Note:
You cannot export data from a mailbox in one forest to a mailbox in a different forest. The source and target mailboxes must be in the same forest.

Procedure

To use the Exchange Management Shell to copy specific messages to a target mailbox

  • Run the following command:

    Copy Code
    Get-Mailbox -Database DataBase1 | Export-Mailbox -ContentKeywords "Virus Message" -TargetMailbox Administrator@Contoso.com -TargetFolder 'MessageFolder'
    

To use the Exchange Management Shell to delete specific messages

  • Run the following command:

    Copy Code
    Get-Mailbox -Database DataBase1 | Export-Mailbox -ContentKeywords "Virus message" -TargetMailbox Administrator@Contoso.com -TargetFolder 'MyData' -DeleteContent
    

For detailed syntax and parameter information, see the following topics: