Create search topology with PowerShell

Managing SharePoint with PowerShell cmdlets is sometimes not the same as doing so from the Central Administration web site. As already written multiple times creating the UPA with PowerShell is still quite challenging. Now I figured out that creating the Enterprise Search Service Application with PowerShell cmdlets is obviously even proplematically as the UPA.

When you create the Enterprise Search Service Application from the Central Administration UI everything is quite okay. You create the Service Application and then you can create you topology.

But creating the service application with the cmdlet New-SPEnterpriseSearchServiceApplication everything seems to be okay unless you try to manage your topology. When trying to do so you might face the following UI:

The reason for that is that obviously the PowerShell cmdlet will not create the administrative component. You can deploy that component with the cmdlet Set-SPEnterpriseSearchAdministrationComponent. Keeping that in mind you can deploy an Enterprise Search Service Application with the following PowerShell code:

$CommonServiceAppsAppPoolName = "Service Applications Application Pool"
$CommonServiceAppsAppPool = (Get-SPServiceApplicationPool | ? {$_.Name -eq $CommonServiceAppsAppPoolName})
$EnterpriseSearchServiceApplicationName = "DEV - Enterprise Search Service"
$EnterpriseSearchServiceAppProxyName = "DEV - Enterprise Search Service Proxy"
$EnterpriseSearchServiceDatabaseName = "DEV - EnterpriseSearchServiceDB_00"

$EnterpriseSearchServiceApp = New-SPEnterpriseSearchServiceApplication -ApplicationPool $CommonServiceAppsAppPool -AdminApplicationPool $CommonServiceAppsAppPool -Name $EnterpriseSearchServiceApplicationName -DatabaseName $EnterpriseSearchServiceDatabaseName -DatabaseServer $DBServerSERVICE
$EnterpriseSearchServiceAppProxy = New-SPEnterpriseSearchServiceApplicationProxy -name $EnterpriseSearchServiceAppProxyName -SearchApplication $EnterpriseSearchServiceApp
$EnterpriseSearchServiceInstance = Get-SPEnterpriseSearchServiceInstance -local
Set-SPEnterpriseSearchAdministrationComponent -SearchApplication $EnterpriseSearchServiceApp -SearchServiceInstance $EnterpriseSearchServiceInstance

The result of that code will be shown in the following screenshot - a service application that you can now start to configure:


Learn more on how to create a crawl and query topology with one of my following posts.

Comments (0)

Skip to main content