Wednesday 13 January 2016

Locate a specific existing or deleted mail item with the Search-Mailbox cmdlet

The below is an example of how you can search for mail items within a mailbox database:
Get-Mailbox –Database VIP -ResultSize Unlimited | Search-Mailbox -TargetMailbox AdminSearchMailbox -TargetFolder "Search Results" -SearchQuery {Subject:"Your Subject" AND From:"user@domain.com" AND Sent:"20/01/2016"} -LogOnly -LogLevel Full –SearchDumpster
** Where AdminSearchBox is equal to the mailbox where you want the results delivered too **

The addition of 'SearchDumpster' allows you to search for deleted items that are recoverable.

Once you have identified the mail you want you can then re-run the command - this time excluding the '-LogOnly' switch. This will prompt Exchange to copy all of found message(s) to a folder within the target mailbox.
Get-Mailbox –Database VIP -ResultSize Unlimited | Search-Mailbox -TargetMailbox AdminSearchMailbox -TargetFolder "Search Results" -SearchQuery {Subject:"Your Subject" AND From:"user@domain.com" AND Sent:"20/01/2016"} -LogLevel Full –SearchDumpster

0 comments:

Post a Comment