0

I am trying to search emails that contains some string in their body. I have two email which contains the work booze.

The command I am using to search is

Get-Mailbox | Search-Mailbox -SearchQuery "Body:'booze'" -WarningAction:SilentlyContinue -EstimateResultOnly -SearchDumpster:$false

but this command is returning 0. What is wrong with this command?

I run a similar command for subject which works

Get-Mailbox | Search-Mailbox -SearchQuery "Subject:'test'" -WarningAction:SilentlyContinue -EstimateResultOnly -SearchDumpster:$false
ksernow
  • 662
  • 3
  • 14
  • 33

2 Answers2

0

You don't need to add the Body: section. Try this (untested):

Get-Mailbox | Search-Mailbox -SearchQuery 'booze' -WarningAction:SilentlyContinue -EstimateResultOnly -SearchDumpster:$false

https://technet.microsoft.com/en-us/library/dd298173(v=exchg.160).aspx

A. Bresno
  • 43
  • 5
0

I just ran this on my Exchange 2016 box on some random user and it returned over 13,000 results:

Search-Mailbox RANDOMUSER -SearchQuery "Body:'it'" -EstimateResultOnly

And this returned an insane amount of results on pretty much every mailbox:

Get-Mailbox | Search-Mailbox -SearchQuery "Body:'it'" -WarningAction:SilentlyContinue -EstimateResultOnly -SearchDumpster:$false
Justin Emlay
  • 904
  • 9
  • 10