PowerShell to create your SharePoint Search Topology.

The architecture and design of search in SharePoint 2013 have changed a bit. There are more added components and more flexibility for high availability search farm, allowing the farm to index more than 100 million items.

In this article, I am going to show how you can create SharePoint 2013 Search Service Application Using PowerShell. This list of commands will allow you to name your own database, instead having a GUID based database name for search.

There are several steps involved in the creation of a Search Service Application and defining the Search Topology. The steps are:

  1. Creating the Search Service Application
  2. Creating the Search Service Application Proxy
  3. Creating the Search Components
  4. Creating the Index

You can follow the list of commands shown below to create your search topology or you can modify it if you want to split some search components into multiple servers.

# Define the variables

*$SSADB = "SharePoint_Demo_SearchAdmin"

*

*$SSAName = "Search Service Application"

*

*$SVCAcct = "mcm\sp_search"

*

$SSI = get-spenterprisesearchserviceinstance -local

#1. Start the search services for SSI

Start-SPEnterpriseSearchServiceInstance -Identity $SSI

#2. Create the Application Pool

$AppPool = new-SPServiceApplicationPool -name $SSAName"-AppPool" -account $SVCAcct

#3. Create the search application and set it to a variable

$SearchApp = New-SPEnterpriseSearchServiceApplication -Name $SSAName -applicationpool $AppPool -databaseserver SQL2012 -databasename $SSADB

#4. Create search service application proxy

$SSAProxy = new-SPEnterpriseSearchServiceApplicationProxy -name $SSAName" Application Proxy" -Uri $SearchApp.Uri.AbsoluteURI

#5. Provision Search Admin Component

Set-SPEnterpriseSearchAdministrationComponent -searchapplication $SearchApp -searchserviceinstance $SSI

#6. Create the topology

$Topology = New-SPEnterpriseSearchTopology -SearchApplication $SearchApp

#7. Assign component(s) to the topology

*$hostApp1 = Get-SPEnterpriseSearchServiceInstance -Identity "SP2013"

*

# Replace your SPSearchServer1 with the name of your server.

*New-SPEnterpriseSearchAdminComponent -SearchTopology $Topology -SearchServiceInstance $hostApp1

New-SPEnterpriseSearchCrawlComponent -SearchTopology $Topology -SearchServiceInstance $hostApp1

New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $Topology -SearchServiceInstance $hostApp1

New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $Topology -SearchServiceInstance $hostApp1

New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $Topology -SearchServiceInstance $hostApp1

New-SPEnterpriseSearchIndexComponent -SearchTopology $Topology -SearchServiceInstance $hostApp1 –IndexPartition 0 -RootDirectory "S:\SearchIndex"*

# RootDirectory is where you want to host your partition. You can exclude this parameter from your script if you would like to, but it is recommended to have your partition stored on a separate storage device with high RPM (preferred to be SSD). If you do not include this parameter in your line, then the partition will be created in your default Office Server location.
**

**#8. Create the topology

$Topology | Set-SPEnterpriseSearchTopology

Once this is completed, navigate to you Application Services page and you should see your SSA already created. Your Search topology should look similar to this: