Category Archives: Powershell

Searching Exchange 2010 mailboxes with Powershell

If you don’t have access then assign the role to the required user account New-ManagementRoleAssignment -Role “Mailbox Import Export” -User administrator

This will search every mailbox for messages containing the word FINDME in the message body and export them to the administrator mailbox in a subfolder called Results

  • Get-Mailbox -ResultSize Unlimited | Search-Mailbox -SearchQuery “Body:’*FINDME*’” -TargetMailbox administrator -TargetFolder Results

If you want to search a single mailbox using the body

  • Search-Mailbox -Identity user1 -SearchQuery “Body:’*FINDME*’” -TargetMailbox administrator -TargetFolder inbox

You can also replace the word Body with Subject, From, To etc…