Repair-ExchangeSearchSymlinks.ps1

Description

This script can be used to repair Mailbox servers that no longer have symbolic links defined in the registry.  The symbolic links are necessary for content index to search the databases.  For more information, please see http://blogs.technet.com/b/exchange/archive/2011/06/30/after-installing-exchange-2010-service-pack-1-searching-via-owa-or-outlook-online-mode-fails.aspx.

Script

PowerShell
Edit|Remove
write-host "Attempting to repair symbolic links" 
 
write-host "Stopping msftesql-exchange and msexchangesearch services" 
stop-service -Force msexchangesearch 
stop-service -Force msftesql-exchange 
 
$rval = get-PSSnapin -Name Microsoft.Exchange.Management.PowerShell.Setup -ea SilentlyContinue 
if(!$rval) 
{ 
    add-PSSnapin -Name Microsoft.Exchange.Management.PowerShell.Setup -ea SilentlyContinue 
} 
 
write-host "Installing symbolic links" 
Install-ContentIndexingService –HubOnlyFilterRegistration 
 
if(!$rval) 
{ 
    Remove-PSSnapin -Name Microsoft.Exchange.Management.PowerShell.Setup -ea SilentlyContinue 
} 
 
write-host "Starting msftesql-exchange and msexchangesearch services" 
start-service msexchangesearch 
start-service msftesql-exchange 
 
write-host "Symbolic links restored." 
write-host "Please run test-exchangesearch to verify installation."