Unable to Create Search Service Application in SharePoint 2019 multi-Server Farm

ananpeculiar 181 Reputation points
2021-12-22T18:25:44.887+00:00

SharePoint 2019 Search Service Application is showing Error and the service is not getting started,

Error:-

The Search Service is not able to connect to the machine that host Administration components, Verify the administration component "GUID" in Search Application is in a good state and try Again

Tried Below Steps but nothing works

1) Component Refresh:-

  • $ssa = Get-SPEnterpriseSearchServiceApplication "Search Service Application"
  • $ssa.RefreshComponents()

**2) **Service Provisioning:-****

  • $service = Get-SPServiceInstance -Identity 7649ed8f-a46c-4a69-a79b-9a153b9f1fd2
  • $service.provision()
  • $service.update()
  • iisreset /noforce

3) Remove Search Application:-

  • $ssa = Get-SPServiceApplication -Name 'Search Service Application'
  • Remove-SPServiceApplication $ssa
    While Removing the Search Application it got struck for more than 2 hours, then i need to restarted the timer Service until it completes the process, looks wired

4) Creating the Search Service Application:-

  • $appPool = get-SPServiceApplicationPool -Identity 'SharePoint Web Services Default'
  • New-SPEnterpriseSearchServiceApplication -Name "Search Service Application" -ApplicationPool $appPool
    While Creating the Search Application it got struck for more than 2 hours, then i need to restarted the timer Service until it completes the process, looks wired. and at the End Same Error

After Continuous Restarting of the timer Service the service get created with Error Unable to retrieve topology component health states. This may be because the admin component is not up and running.

and at the final Search Service Application Proxy is not getting created

Kindly help to recreate the Search Service Application from the scratch.

Microsoft 365 and Office SharePoint Server For business
0 comments No comments
{count} votes

Accepted answer
  1. JoyZ 18,111 Reputation points
    2021-12-23T06:32:44.237+00:00

    @ananpeculiar ,

    Remove the problematic search service application first, then run following powershell to create a new search service application:

    Remember to change the related parameter such as $SearchDatabaseServer,$SearchAppPoolAccount.

    #Create Search Service Application  
    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue  
    # Specify the Settings for the Search Service Application  
    $ServerName = (Get-ChildItem env:computername).value  
    $IndexLocation = "C:\Search Index"  
    $SearchServiceApplicationName = "Search Service Application"  
    $SearchServiceApplicationProxyName = "Search Service Application Proxy"  
    $SearchDatabaseServer = "SQL19"  
    $SearchServiceApplicationDatabase = "SP2019_Search_Service"  
      
    $SearchAppPoolName = "Search Service Application pool"  
    $SearchAppPoolAccount = Get-SPManagedAccount "Julie\spfarm"  
      
    #Check if Managed account is registered already  
    Write-Host -ForegroundColor Yellow "Checking if the Managed Accounts already exists"  
    $SearchAppPoolAccount = Get-SPManagedAccount -Identity $SearchAppPoolAccount -ErrorAction SilentlyContinue  
    If ($SearchAppPoolAccount -eq $null)  
    {  
    Write-Host "Please Enter the password for the Service Account..."  
    $AppPoolCredentials = Get-Credential $SearchAppPoolAccount  
    $SearchAppPoolAccount = New-SPManagedAccount -Credential $AppPoolCredentials  
    }  
      
    #*** Step 1: Create Application Pool for Search Service Application ****  
    #Get the existing Application Pool  
    $SearchServiceAppPool = Get-SPServiceApplicationPool -Identity $SearchAppPoolName -ErrorAction SilentlyContinue  
    #If Application pool Doesn't exists, Create it  
    if (!$SearchServiceAppPool)  
    {  
    $SearchServiceAppPool = New-SPServiceApplicationPool -Name $SearchAppPoolName -Account $SearchAppPoolAccount  
    write-host "Created New Application Pool" -ForegroundColor Green  
    }  
      
    #*** Step 2: Start Search Service Instances ***  
    Start-SPEnterpriseSearchServiceInstance $ServerName -ErrorAction SilentlyContinue  
    Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance $ServerName -ErrorAction SilentlyContinue  
      
    #*** Step 3: Create Search Service Application ****  
    # Get the Search Service Application  
    $SearchServiceApplication = Get-SPEnterpriseSearchServiceApplication -Identity $SearchServiceApplicationName -ErrorAction SilentlyContinue  
    # Create the Search Service Application, If it doesn't exists!  
    if(!$SearchServiceApplication)  
    {  
    $SearchServiceApplication = New-SPEnterpriseSearchServiceApplication -Name $SearchServiceApplicationName -ApplicationPool $SearchServiceAppPool -DatabaseServer $SearchDatabaseServer -DatabaseName $SearchServiceApplicationDatabase  
    write-host "Created New Search Service Application" -ForegroundColor Green  
    }  
      
    #*** Step 4: Create Search Service Application Proxy ****  
    #Get the Search Service Application Proxy  
    $SearchServiceAppProxy = Get-SPEnterpriseSearchServiceApplicationProxy -Identity $SearchServiceApplicationProxyName -ErrorAction SilentlyContinue  
    # Create the Proxy, If it doesn't exists!  
    if(!$SearchServiceAppProxy)  
    {  
    $SearchServiceAppProxy = New-SPEnterpriseSearchServiceApplicationProxy -Name $SearchServiceApplicationProxyName -SearchApplication $SearchServiceApplication  
    write-host "Created New Search Service Application Proxy" -ForegroundColor Green  
    }  
      
    #*** Step 5: Create New Search Topology  
    $SearchServiceInstance = Get-SPEnterpriseSearchServiceInstance -Local  
    #To Get Search Service Instance on Other Servers: use - $SearchServiceAppSrv1 = Get-SPEnterpriseSearchServiceInstance -Identity "<Server Name>"  
      
    # Create New Search Topology  
    $SearchTopology = New-SPEnterpriseSearchTopology -SearchApplication $SearchServiceApplication  
      
    #*** Step 6: Create Components of Search  
      
    New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $SearchTopology -SearchServiceInstance $SearchServiceInstance  
      
    New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $SearchTopology -SearchServiceInstance $SearchServiceInstance  
      
    New-SPEnterpriseSearchCrawlComponent -SearchTopology $SearchTopology -SearchServiceInstance $SearchServiceInstance  
      
    New-SPEnterpriseSearchAdminComponent -SearchTopology $SearchTopology -SearchServiceInstance $SearchServiceInstance  
      
    #Prepare Index Location  
    Remove-Item -Recurse -Force -LiteralPath $IndexLocation -ErrorAction SilentlyContinue  
    MKDIR -Path $IndexLocation -Force  
      
    #Create Index and Query Components  
    New-SPEnterpriseSearchIndexComponent -SearchTopology $SearchTopology -SearchServiceInstance $SearchServiceInstance -RootDirectory $IndexLocation  
      
    New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $SearchTopology -SearchServiceInstance $SearchServiceInstance  
      
    #*** Step 7: Activate the Toplogy for Search Service ***  
    # Or Use: Set-SPEnterpriseSearchTopology -Identity $SearchTopology  
    $SearchTopology.Activate()  
    

    Result for your reference:
    159955-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.