In SharePoint you can create a Search Service Application by using PowerShell. If you didn’t create it with AutoSPInstaller or if you want to configure it later on, you should use Powershell for one reason. If you use the GUI in Central Administration, it will create the databases with a GUID in its name.
Powershell Script
So here i like to share the script to create the search service application which i used in a Testing Environment in SharePoint 2019.
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
# Name Application Pool
$SearchAppPoolName = "Search Service App Pool"
# Names for SA and DB's
$serviceAppName = "Search Service Application"
$searchDBName = "SP19_SearchService"
$SearchAppPoolAccountName = "domain\sp_search"
# Application Pool for Search SA
$AppPool = New-SPServiceApplicationPool -Name "Search Service App Pool" -Account $SearchAppPoolAccountName
$AppPool = Get-SPServiceApplicationPool $SearchAppPoolName
# Start Search Service Instances
Get-SPEnterpriseSearchServiceInstance -Local | Start-SPEnterpriseSearchServiceInstance
Get-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance -Local | Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance
$sa = New-SPEnterpriseSearchServiceApplication -Name $serviceAppName -DatabaseName $searchDBName –ApplicationPool $AppPool
New-SPEnterpriseSearchServiceApplicationProxy -Name "Search Service Application Proxy" -SearchApplication $sa
#See if it's working
Get-SPEnterpriseSearchServiceInstance -local
#Clone topology
$clone = $sa.ActiveTopology.Clone()
#Create new topology
$searchServiceInst = Get-SPEnterpriseSearchServiceInstance -local
New-SPEnterpriseSearchAdminComponent -SearchTopology $clone -SearchServiceInstance $searchServiceInst
New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $clone -SearchServiceInstance $searchServiceInst
New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $clone -SearchServiceInstance $searchServiceInst
New-SPEnterpriseSearchCrawlComponent -SearchTopology $clone -SearchServiceInstance $searchServiceInst
New-SPEnterpriseSearchIndexComponent -SearchTopology $clone -SearchServiceInstance $searchServiceInst -IndexPartition 0 -RootDirectory D:\Index\
New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $clone -SearchServiceInstance $searchServiceInst
#Activate new topology
$clone.Activate()
After this your Search Service should be running. Now it is time to care about the following steps:
- Add a search crawl account
- Add a search center site collection
- Add and configure your Content Sources
Hope it helps you. If you like to read more about SharePoint Search in 2019 i can recommend you the following articles:
What’s new in search
What’s new in SharePoint 2019
Leave a Reply