susnewyork
asked on
search-maillbox exact search criteria
Hello,
I have a basic script that searches all mailboxes on our exchange server. How can I limit the search criteria to an exact match?
Search-Mailbox -SearchQuery 'Subject: "TEST"', 'Body: "Test"' -targetmailbox "jbuzzetta" -targetfolder "inbox" -logonly -loglevel full
Results for test, testify, retest will all show up.
I'd like to see only TEST.
I have a basic script that searches all mailboxes on our exchange server. How can I limit the search criteria to an exact match?
Search-Mailbox -SearchQuery 'Subject: "TEST"', 'Body: "Test"' -targetmailbox "jbuzzetta" -targetfolder "inbox" -logonly -loglevel full
Results for test, testify, retest will all show up.
I'd like to see only TEST.
I think what you are taking is the default behavior for Search-mailbox.. You need to add more condition to narrow down your search..
For example..
For example..
Search-Mailbox -Identity subsun -SearchQuery 'from:subsuntest AND sent:6/11/2013 AND Subject:"Test mail"' -TargetMailbox Adminmailbox -TargetFolder SearchLogs -LogOnly -LogLevel Full
ASKER
PowerShell can't find exact strings excluding extra string data from the search? That sounds like basic functionality. I'd expect that I'd have to use -like to get the results that subject:"Test" is giving.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
BTB if you are just trying to export the mails then you can try New-MailboxExportRequest with parameter ContentFilter, it allows you to filter the messages based on subject..
Refer :
http://technet.microsoft.com/en-us/library/ff607299(v=exchg.141).aspx
http://technet.microsoft.com/en-us/library/ff601762(v=exchg.141).aspx
Refer :
http://technet.microsoft.com/en-us/library/ff607299(v=exchg.141).aspx
http://technet.microsoft.com/en-us/library/ff601762(v=exchg.141).aspx
Open in new window
For subject searching syntax should beOpen in new window