Search-Mailbox subject with symbols

escpoar 21 Reputation points
2021-06-01T10:56:43.327+00:00

Dear all,
I am facing a problem searching for e-mails with subject containing symbols.I've tried different ways, but it doesn't find anything.

Search-Mailbox -identity identity -SearchQuery "subject:test:dog/cat" -DeleteContent -Force -Confirm:$false
Search-Mailbox -identity identity -SearchQuery "subject:'test:dog/cat'" -DeleteContent -Force -Confirm:$false
Search-Mailbox -identity identity -SearchQuery 'subject:"test:dog/cat"' -DeleteContent -Force -Confirm:$false

Using KQLQuery doesn't help as well.

$subject = "test:dog/cat"
$search =  "subject:$subject"
$KQLQuery =[scriptblock]::create($search)

could someone advice, please?
Thank you

Exchange | Exchange Server | Management
{count} votes

1 answer

Sort by: Most helpful
  1. KyleXu-MSFT 26,396 Reputation points
    2021-06-02T02:23:23.733+00:00

    @escpoar

    There doesn't exist issue with the search query:
    101486-qa-kyle-10-10-09.png

    101526-qa-kyle-10-22-37.png
    This issue may related with Exchange index, if your mailboxes hosted on Exchange 2010/2013/2016, you can take step below to rebuild database index:
    Stop those two services:
    101457-qa-kyle-10-12-35.png

    Delete "XXXXXX.Single" folder from database path:
    101535-qa-kyle-10-14-07.png

    Restart above two services and search again.

    If your mailbox hosted on Exchange 2019 database, try to create a new database and migrate this mailbox to it and search again.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.