Search-Mailbox -searchquery question pertaining * (wild cards)

In Exchange 2010  -  I would like to use * (wild card) in a searchquery  i know the following script line works

Get-Mailbox  -resultsize unlimited | Search-Mailbox -searchquery {Attachment:"servers.txt" AND Subject:"Testing the search capabilities"}  -estimateresultonly

Can i use the following?  (using wildcards)

Get-Mailbox  -resultsize unlimited | Search-Mailbox -searchquery {Attachment:"servers.txt" AND Subject:"*capabili*"}  -estimateresultonly

it appears it is searching for * and not as a wild card.

Can a search using wild card be done?

  • I believe that if you are searching for whole words, then no wild cards are needed.  Subject:"blah" will match an email with subjects "whatever blah" "blah whatever" "whatever blah whatever"

    Then it'll support prefix matching wild cards only, so Subject:"bla*" will match "whatever blasahblah"

    But Subject:"*lah" will not match "whatever blah" it will match "whatever *lah"

    So it searches for whole words and the wildcard is only supported on the end. 

    So based on what you put Subject:"capabili*" should work.

    This is all based on my reading of the documentation for KQL linked to from the documentation of Search-Mailbox.  Can't test right now, so take it as something test.

  • Craig - Your post is accurate - I tested without wildcards, I did have to input the whole word - not partial - partial did not work for me - thx