We help IT Professionals succeed at work.

Exchange 2010 SP1 Shell Query?

I have a group of Exchange 2010 SP1 mailboxes that I have to search individually for a set of search strings.  If I find items related to the search string, I have to export a copy of that email to a PST file for later use.  I do not want to modify the contents of the mailbox, only export copies.  What's the command I should use?  

Basically i want to:

search John Doe's mailbox for "applesauce", export copies of all emails with the word "applesauce" to John.Doe.pst

Watch Question

IT Security Architect
http://technet.microsoft.com/en-us/library/ff607299.aspx - New-ExportMailboxRequest
http://technet.microsoft.com/en-us/library/ff601762.aspx - ContentFiltering

$Users = "John Doe","Jane Doe","etc"

foreach ($User in $Users){
   $Filepath = "\\Server1\Share1\" + $User + ".pst"
   Get-Mailbox $User | New-ExportMailboxRequest -ContentFilter {All -like "*applesauce*"} -FilePath $FilePath

Open in new window

This will Export all e-mails containing the word applesauce anywhere in the message to a pst-file named after the user in \\Server1\Share1
Make sure you have the proper permissions before running this.