locked
Searching all Mailboxes for Keywords (Exch 2007) RRS feed

  • Question

  • I've been asked to run a search across my companies mailserver for specific keywords within all mailboxes.  Having done a search I've found the information I require, but started to panic having run the command line as it started going through mailboxes and showing it was moving messages.

    This is the command line I am using;

    Get-Mailbox -Database MyDB | Export-Mailbox -SubjectKeywords "keyword" -TargetMailbox "My Mailbox" -TargetFolder "My Folder"

    Under my Mailbox it creates a recovery folder for each mailbox searched and recreates their folder structure regardless of it finding a keyword match.  Having checked a number of sites/forums this seems to be correct, or is there a better way to achieve the same result?  Other wise I'm going to end up then having to manually search within each folder for the keywords as well.

    Thanks in advance.

    Friday, December 28, 2012 3:04 PM

All replies

  • When you say " Other wise I'm going to end up then having to manually search within each folder for the keywords as well."  do you mean that you will have to look into each folder to see if it contains content or is empty or??

    Troy Werelius
    www.Lucid8.com
    Search, Recover, & Extract Mailboxes, Folders, & Email Items from Offline EDB's and Live Exchange Servers or Import/Migrate direct from Offline EDB to Any Production Exchange Server, even cross version i.e. 2003 --> 2007 --> 2010 with Lucid8's DigiScope

    Friday, December 28, 2012 6:02 PM
  • When you say " Other wise I'm going to end up then having to manually search within each folder for the keywords as well."  do you mean that you will have to look into each folder to see if it contains content or is empty or??

    Troy Werelius
    www.Lucid8.com
    Search, Recover, & Extract Mailboxes, Folders, & Email Items from Offline EDB's and Live Exchange Servers or Import/Migrate direct from Offline EDB to Any Production Exchange Server, even cross version i.e. 2003 --> 2007 --> 2010 with Lucid8's DigiScope

    What I mean is, with the current method I will have to run the command to search for keywords across all of the mailboxes stored on my mail server which in turn means I end up with a recovery folder within my own mailbox for each mailbox searched.  And within each recovery folder I will have the various subfolders (Inbox/Sent Items etc) for each mailbox regardless of them holding the information I am looking for.  So once the mail server search is complete I now have to go in to each folder to see if it holds any mail.  Or I can do a 2nd search from within Outlook of my own mailbox for the same keywords.

    Either way it's a lot of work for something that should be simple to perform without the need to resort to third party tools.

    Saturday, December 29, 2012 1:54 PM
  • ok so

    1. it sounds like you are getting the desired results with the search, i.e. its copying out the data you desire correct?

    2. is your concern that there may be a folder structure built that is empty and you want to avoid handing over a structure that would give more information than desired or?

    So you end up with the entire structure because when use any keyword parameters, Export-Mailbox will

    A: Export ALL of the messages, including messages in the dumpster, and then search the
    target mailbox for messages that meet the keyword criteria.

    B: Messages that were in the dumpster on the source mailbox are converted to regular
    messages on the target mailbox and will also be searched for keywords.

    C: Export-Mailbox then deletes messages on the target mailbox that do not
    match the keyword criteria.

    I don't know of a clean way to get rid of folder structures that do not contain anything upon completion, however I think that you could

    1. Do a search in Google on something like "Delete Empty Outlook Folders" and see if you find something that meets your needs.  I saw some freeware and other scripting examples but have not tested them and I would definitely run against a test mailbox first.

    2. Found this script example for 2010 that may serve you well http://social.technet.microsoft.com/Forums/en/ITCG/thread/5da9aa67-f796-4471-b638-ead6263d554a

    3. other option would be to use a 3rd party product to do the search and export like Lucid8's DigiScope http://www.lucid8.com/product/digiscope.asp which can do exactly what your looking for via an offline copy of the database as well as against a production version.


    Troy Werelius
    www.Lucid8.com
    Search, Recover, & Extract Mailboxes, Folders, & Email Items from Offline EDB's and Live Exchange Servers or Import/Migrate direct from Offline EDB to Any Production Exchange Server, even cross version i.e. 2003 --> 2007 --> 2010 with Lucid8's DigiScope

    Monday, December 31, 2012 12:20 AM
  • Hi,

    If you use SubjectKeywords to filter message, it seems to can’t classify messages .


    Wendy Liu
    TechNet Community Support

    Monday, December 31, 2012 9:08 AM
    Moderator