Adding a second Crawl Server in SharePoint 2010 via PowerShell

Here are the steps involved in adding a second crawl server can be done via the Central Admin or PowerShell.
This is perfect if you need a second crawl server for redundancy. The following steps will allow you to add this second crawl server to the existing topology and adding it to the existing crawl database.

Here’s how you do it in the Central Admin:
Search Admin > Modify Search Application Topology> NEW Crawl Component > Select new Server from drop down list, Specify existing crawl database, Specify Temporary location of Index > Click OK and then Click ‘Apply Topology Changes’

Now to do it in PowerShell! The procedure is to clone the existing topology,Create the crawl component, Activate the new cloned topology and delete the old.
Run this on the new crawl server:

# Start the Search service on the server

$SearchSAInstance = Get-SPEnterpriseSearchServiceInstance -local -erroraction SilentlyContinue #Just to mute out the noise if any
Start-SPEnterpriseSearchServiceInstance -Identity $SearchSAInstance

# Retrieve the active topology

$searchSAName = “<Type in the name of your Search Service Application>”

$InitialCrawlTopology = $searchSAName | Get-SPEnterpriseSearchCrawlTopology -Active

$InitialCrawlTopology

# Clone the topology

$CrawlTopology = $searchSAName | New-SPEnterpriseSearchCrawlTopology -Clone -CrawlTopology $InitialCrawlTopology

# Create the new crawl component

$CrawlDatabase0 = ([array]($searchSAName | Get-SPEnterpriseSearchCrawlDatabase))[0]

$searchInstance0 = Get-SPEnterpriseSearchServiceInstance #env:COMPUTERNAME

$CrawlComponent0 = New-SPEnterpriseSearchCrawlComponent -CrawlTopology $CrawlTopology -CrawlDatabase $CrawlDatabase0 -SearchServiceInstance $searchInstance0 -IndexLocation $searchInstance0.DefaultIndexLocation

# Activate the new crawl topology

$CrawlTopology | Set-SPEnterpriseSearchCrawlTopology -Active

Write-Host -ForegroundColor white Waiting for the old crawl topology to become inactive

do {write-host -NoNewline .;Start-Sleep 10;} while ($InitialCrawlTopology.State -ne “Inactive”)
# Delete the old crawl topology

$InitialCrawlTopology | Remove-SPEnterpriseSearchCrawlTopology

2 thoughts on “Adding a second Crawl Server in SharePoint 2010 via PowerShell

Leave a Reply

Your email address will not be published. Required fields are marked *