Solved

search-maillbox exact search criteria

Posted on 2013-06-10
5
391 Views
Last Modified: 2013-06-12
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.
0
Comment
Question by:susnewyork
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 9

Expert Comment

by:David Carr
ID: 39235787
Check that search is running and has a completed index.  look for Event ID 110 in logs to confirm completion.
Test-ExchangeSearch -Identity user@domain.com

Open in new window

For subject searching syntax should be
Search-Mailbox -SearchQuery subject:"Test" -TargetMailbox Administrator -TargetFolder SearchLogs -LogOnly -LogLevel Full

Open in new window

0
 
LVL 40

Expert Comment

by:Subsun
ID: 39237312
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..
Search-Mailbox -Identity subsun -SearchQuery 'from:subsuntest AND sent:6/11/2013 AND Subject:"Test mail"' -TargetMailbox Adminmailbox -TargetFolder SearchLogs -LogOnly -LogLevel Full

Open in new window

0
 
LVL 1

Author Comment

by:susnewyork
ID: 39237735
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.
0
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 39240942
Search-Mailbox wont suport those operators or any RegEX.. Also the command wont pass any subject propery to pipeline so we cannot filter it..
0
 
LVL 40

Expert Comment

by:Subsun
ID: 39241082
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
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

631 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question