D
D
Dmitry Shumov2020-06-09 12:19:34
PowerShell
Dmitry Shumov, 2020-06-09 12:19:34

How to write an email search query in Exchange?

Colleagues, I need help with PowerShell for Exchange:
I'm trying to search for and then delete messages inside the mail system.
The task is extremely basic, but complicated by the fact that the body of the letter that I am searching for has a “+” symbol in the text.

for example

Get-Mailbox -Identity "user" | Search-Mailbox -SearchQuery body: 'Машина+' -EstimateResultOnly | export-csv -Delimiter ";" -encoding UTF8 C:\temp\test.csv


We need the correct syntax for a command that would search for letters in the mailbox by content, taking into account the fact that the search query contains the “+”

sign There are letters in the mailbox with the text:
Car +
Car
Car +


Of these, for example, you need to find only
“Car +”
And a separate search for
“Machine +”

PS As if I dug a little, but it’s clearer how to solve the problem did not appear:
1. The Keyword Query Language is used as the search language, this language has its own syntax described in this article - https://docs. microsoft.com/en-us/exchange/security...
2. One of the operators of this language is just the “+” sign, it acts as an AND operator and no matter how we pass this sign, the interpreter perceives it as an operator (i.e. we are looking for Machine AND “empty” - the result is always zero) .

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Bezrukov, 2020-06-09
@NortheR73

And so?
-SearchQuery 'body:"car+"'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question