locked
How to? Exchange 2007, Search a keyword through multiple mailboxes RRS feed

  • Question

  • I need some help with something.

    We have exchange 2007 running on windows 2003 R2.

    I need to search 50 users mailboxes and search for a keyword in the body of the email from a specific date and extract the e-mails that include this keyword from those 50 mailboxes.

    I have researched this and the only thing I was able to find was it would search the whole database... which is not what we want. We just want to search 50 specific mailboxes. Any input would be appreciated.

    Thanks

    Tuesday, June 19, 2012 10:23 PM

Answers

  • You can use the Export-Mailbox cmdlet.

    First create a CSV file with this format--the first line is as shown and the rest are the names of the mailboxes to be searched.

    Name
    Harry Potter
    Hermione Granger
    Ron Weasley

    Then you can write a script of this form.

    $Names = Import-CSV -Path C:\Names.csv
    ForEach ($Name in $Names) {
      Export-Mailbox -Identity $Name -AllContentKeywords "Fudge" -ReportFile C:\BadWords.xml -PSTFolderPath C:\ExportedStuff.pst
    }

    This is just an example; there are a lot of options for the Export-Mailbox cmdlet.  You can read more here:

    http://technet.microsoft.com/en-us/library/aa998579(v=exchg.80).aspx

    http://blogs.technet.com/b/exchange/archive/2006/12/18/3397563.aspx


    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."

    • Marked as answer by emma.yoyo Tuesday, June 26, 2012 2:02 AM
    Tuesday, June 19, 2012 11:40 PM
  •  And where do we specifiy the mailbox name? I am assuming the $name would be the mailbox?

    Hi Qais,

    As Ed said, you can create a csv file and list the mailboxes name into it, e.g. C:\name.csv, the file format is:

    Name
    Harry Potter
    Hermione Granger
    Ron Weasley

    ....

    If you just want to run a command, please refer to the Scenario 1 in the following link provide by Ed as well:

    http://blogs.technet.com/b/exchange/archive/2006/12/18/3397563.aspx

    get-mailbox –Database DB1 | Export-Mailbox –SubjectKeywords "Discovery Keywords" –TargetMailbox Administrator –TargetFolder 'MyData'

    You can modify the Get-Mailbox to filter 50 mailboxes which you want to search. For example:

    Get-Mailbox -Filter {CustomAttribute1 -eq "abc"} | Export-mailbox...


    Frank Wang

    TechNet Community Support

    • Marked as answer by emma.yoyo Tuesday, June 26, 2012 2:02 AM
    Thursday, June 21, 2012 6:20 AM

All replies

  • You can use the Export-Mailbox cmdlet.

    First create a CSV file with this format--the first line is as shown and the rest are the names of the mailboxes to be searched.

    Name
    Harry Potter
    Hermione Granger
    Ron Weasley

    Then you can write a script of this form.

    $Names = Import-CSV -Path C:\Names.csv
    ForEach ($Name in $Names) {
      Export-Mailbox -Identity $Name -AllContentKeywords "Fudge" -ReportFile C:\BadWords.xml -PSTFolderPath C:\ExportedStuff.pst
    }

    This is just an example; there are a lot of options for the Export-Mailbox cmdlet.  You can read more here:

    http://technet.microsoft.com/en-us/library/aa998579(v=exchg.80).aspx

    http://blogs.technet.com/b/exchange/archive/2006/12/18/3397563.aspx


    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."

    • Marked as answer by emma.yoyo Tuesday, June 26, 2012 2:02 AM
    Tuesday, June 19, 2012 11:40 PM
  • You can use the Export-Mailbox cmdlet.

    First create a CSV file with this format--the first line is as shown and the rest are the names of the mailboxes to be searched.

    Name
    Harry Potter
    Hermione Granger
    Ron Weasley

    Then you can write a script of this form.

    $Names = Import-CSV -Path C:\Names.csv
    ForEach ($Name in $Names) {
      Export-Mailbox -Identity $Name -AllContentKeywords "Fudge" -ReportFile C:\BadWords.xml -PSTFolderPath C:\ExportedStuff.pst
    }

    This is just an example; there are a lot of options for the Export-Mailbox cmdlet.  You can read more here:

    http://technet.microsoft.com/en-us/library/aa998579(v=exchg.80).aspx

    http://blogs.technet.com/b/exchange/archive/2006/12/18/3397563.aspx


    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."

    Thanks, but is there any way to just run a command in the exchange power shell? And where do we specifiy the mailbox name? I am assuming the $name would be the mailbox? Thanks for your help.
    Wednesday, June 20, 2012 6:15 PM
  •  And where do we specifiy the mailbox name? I am assuming the $name would be the mailbox?

    Hi Qais,

    As Ed said, you can create a csv file and list the mailboxes name into it, e.g. C:\name.csv, the file format is:

    Name
    Harry Potter
    Hermione Granger
    Ron Weasley

    ....

    If you just want to run a command, please refer to the Scenario 1 in the following link provide by Ed as well:

    http://blogs.technet.com/b/exchange/archive/2006/12/18/3397563.aspx

    get-mailbox –Database DB1 | Export-Mailbox –SubjectKeywords "Discovery Keywords" –TargetMailbox Administrator –TargetFolder 'MyData'

    You can modify the Get-Mailbox to filter 50 mailboxes which you want to search. For example:

    Get-Mailbox -Filter {CustomAttribute1 -eq "abc"} | Export-mailbox...


    Frank Wang

    TechNet Community Support

    • Marked as answer by emma.yoyo Tuesday, June 26, 2012 2:02 AM
    Thursday, June 21, 2012 6:20 AM
  • Hi,

    Any updates?


    Frank Wang

    TechNet Community Support

    Monday, June 25, 2012 1:47 AM