Friday, March 20, 2015

Exchange 2010 How to re-index mailbox database

 Note: Do the below if it happens all users on the DB. If just for one user, move the user to other DB to see if the issue is gone.

Exchange 2010 re-index mailbox database
Users may report that searching Outlook for non-cached or online mode mailboxes isn't getting the right results or not returning results past a certain date. Also OWA may return "The action couldn't be completed.  Try again later." when trying to search. You need to reindex your mailbox database(s). 
1. Run Repair-ExchangeSearchSymLinks.ps1. It isn't included in the normal scripts folder under the Exchange program files, you can copy this to a text document and save it as Repair-ExchangeSearchSymLinks.ps1.
01write-host "Attempting to repair symbolic links"
02 
03write-host "Stopping msftesql-exchange and msexchangesearch services"
04stop-service -Force msexchangesearch
05stop-service -Force msftesql-exchange
06 
07$rval = get-PSSnapin -Name Microsoft.Exchange.Management.PowerShell.Setup -ea SilentlyContinue
08if(!$rval)
09{
10 add-PSSnapin -Name Microsoft.Exchange.Management.PowerShell.Setup -ea SilentlyContinue
11}
12 
13write-host "Installing symbolic links"
14Install-ContentIndexingService –HubOnlyFilterRegistration
15 
16if(!$rval)
17{
18 Remove-PSSnapin -Name Microsoft.Exchange.Management.PowerShell.Setup -ea SilentlyContinue
19}
20 
21write-host "Starting msftesql-exchange and msexchangesearch services"
22start-service msexchangesearch
23start-service msftesql-exchange
24 
25write-host "Symbolic links restored."
26write-host "Please run test-exchangesearch to verify installation."
Or you can get it from Microsoft here if you don't trust me and place it in the Exchange Server\V14\Scripts folder. Open Exchange Management Shell (remember you might need to run EMS elevated and run Set-ExecutionPolicy Unrestricted first), change path to the scripts folder then run:
.\Repair-ExchangeSearchSymLinks.ps1
 
2. Next run the ResetSearchIndex.ps1 script, this one is included in the Exchange program files scripts folder so no need to download. You can run it against a specific database or against all of them as per the commands below:

.\ResetSearchIndex.ps1 -All    .\ResetSearchIndex.ps1 databasename
 
You should see event id 109 for each database stating that an index has been created and sometime later event id 110 for each database as the indexing finishes.

Thursday, March 19, 2015

How to: Move Catalog Data in Exchange 2010

How to: Move Catalog Data in Exchange 2010
 
 
When you've moved an mailbox database, the old catalog data is still present on the old partition. This prevents deleting the specific partition. When you try to delete those files, you receive this error.
 
Error description:
The Catalog data folder stays in place after a database move path action. The folder couldn't be cleaned up because it is in use by the Microsoft Exchange Search Indexing service
 
Solution:
First we have to temporarely disable the indexing on the particular mailbox database. Then we stop the indexing service of Exchange so we can delete the remaining files. The last step is to enable the indexing again.
 
Actions:
You can follow the next steps.
 
- Open the Exchange Management Shell and run the following command:

         Set-MailboxDatabase -Identity databasename -IndexEnabled $false

 -Before moving / cleaning the catalog files, stop the service Microsoft Exchange Search Indexer
         - Move the catalog files to the new database location or clean them up.
         - Start the service Microsoft Exchange Search Indexer
        - Open the Exchange Management Shell and run the following command:

    Set-MailboxDatabase -Identity databasename -IndexEnabled $true