Solved

search-maillbox exact search criteria

Posted on 2013-06-10
5
366 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
  • 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
Synchronize a new Active Directory domain with an existing Office 365 tenant
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager

705 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now