Provision Search Service On Any SharePoint Server (with no migration)

This is based on scripts at http://www.harbar.net/articles/sp2013mt.aspx. I have modified the original script because if you are provisioning this on a server that is not the Central Admin server, you may get some NULL errors when you try to complete the component steps.  I have highlighted the part that I have changed.

This script will allow you to provision the search service application on any server of your choosing. Before you run this script, make sure you have activated the following services in Central Admin on the server you wish to set up your SSA on.

Search Host Controller Service
Search Query and Site Settings Service

$saAppPoolName = "Default SharePoint Service App Pool"
$searchServerName = (Get-ChildItem env:computername).value
$serviceAppName = "Search Service Application"
$searchDBName = "SearchService_DB"
$saAppPool = Get-SPServiceApplicationPool $saAppPoolName
Start-SPEnterpriseSearchServiceInstance $searchServerName
Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance $searchServerName
$searchServiceApp = New-SPEnterpriseSearchServiceApplication -Name $serviceAppName -ApplicationPool $saAppPoolName -DatabaseName $searchDBName
$searchProxy = New-SPEnterpriseSearchServiceApplicationProxy -Name "$serviceAppName Proxy" -SearchApplication $searchServiceApp
$clone = $searchServiceApp.ActiveTopology.Clone()
$searchServiceInstance = Get-SPEnterpriseSearchServiceInstance | where-object{$_.Server.Name -eq $searchServerName}
New-SPEnterpriseSearchAdminComponent –SearchTopology $clone -SearchServiceInstance $searchServiceInstance
New-SPEnterpriseSearchContentProcessingComponent –SearchTopology $clone -SearchServiceInstance $searchServiceInstance
New-SPEnterpriseSearchAnalyticsProcessingComponent –SearchTopology $clone -SearchServiceInstance $searchServiceInstance 
New-SPEnterpriseSearchCrawlComponent –SearchTopology $clone -SearchServiceInstance $searchServiceInstance 
New-SPEnterpriseSearchIndexComponent –SearchTopology $clone -SearchServiceInstance $searchServiceInstance
New-SPEnterpriseSearchQueryProcessingComponent –SearchTopology $clone -SearchServiceInstance $searchServiceInstance
$clone.Activate()
Posted in SharePoint 2013.

Leave a Reply

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