SearchMailboxes.ps1 is a script to run a discovery search (using Exchange 2010's Multi-Mailbox Search) periodically on a set of mailboxes. The script works only with Microsoft Exchange 2010 SP1. Please note, Multi-mailbox Search is an Enterprise CAL feature.
Who needs it: A compliance officer who runs discovery searches periodically to look for messages containing specific keywords. It makes life easier by automating the process of running a discovery search at fixed intervals using a scheduled task. Once the script is deployed the compliance officer can log on to the Exchange Control Panel (ECP) and select the particular date for which he/she wants to get search results.
Here is the snapshot of the ECP after running the script weekly:
How the script works: This script runs a discovery search on the specified mailboxes over a period of time. To learn more about discovery, see Understanding Multi-Mailbox Search.
For the first time the search is run, you can specify the start date in the search.config file. The current date is automatically used as the end date. For subsequent searches, the start date is automatically obtained from the previous search. If the previous search is successful, its end date is used as the start date for the new search. If the previous search failed, the start date specified in that search is used as the start date for the new search. This ensures that you don't miss any messages due to a failed search. You can set the frequency at which the script is run by using the Task Scheduler.
Before running the script, make sure that the user account you use to run it is added to the Discovery Management RBAC role group. See Add a User to the Discovery Management Role Group for instructions on how to do this.
The package contains the following files:
powershell -PSConsoleFile "d:\Program Files\Microsoft\Exchange Server\V14\Bin\exshell.psc1" -command ".\SearchMailboxes.ps1
Get-Mailbox -Identity Discovery*
Edit the start date to go back number of days to get the first search results.
Edit the keywords and separate them with the conjunction 'OR'
This is a mandatory file and it needs to be present in the same location as SearchMailboxes.ps1.
Download the script: You can download this script and all of the associated files here.
EDIT 11/30/2010: Added a note that the multi-mailbox search is an Enterprise CAL feature.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.