You can use this code to create a new application pool named “SharePoint Search Service Application Pool”, and then create the search service application with all the search components on one server.
####Run with an account that is a farm admin, use the search service account for the app pool user#### $ssaAppPoolName = "SharePoint Search Service Application Pool" $SearchappPoolUserName = "Contoso\2013Search" $ssaAppPool = Get-SPServiceApplicationPool -Identity $ssaAppPoolName -EA 0 if($ssaAppPool -eq $null) { Write-Host "Creating Search Service Application Pool…" $SearchappPoolAccount = Get-SPManagedAccount -Identity $SearchappPoolUserName -EA 0 if($SearchappPoolAccount -eq $null) { Write-Host "Please supply the password for the Service Account…" $ssappPoolCred = Get-Credential $SearchappPoolUserName $SearchappPoolAccount = New-SPManagedAccount -Credential $ssappPoolCred -EA 0 } $SearchappPoolAccount = Get-SPManagedAccount -Identity $SearchappPoolUserName -EA 0 if($SearchappPoolAccount -eq $null) { Write-Host "Cannot create or find the managed account $SearchappPoolUserName, please ensure the account exists." Exit -1 } New-SPServiceApplicationPool -Name $ssaAppPoolName -Account $SearchappPoolAccount -EA 0 > $null } ## Search Specifics, we are single server farm ## $searchServerName = (Get-ChildItem env:computername).value $serviceAppName = "Enterprise Search Services" $searchDBName = "Search" ## Grab the Appplication Pool for Service Application Endpoint ## $ssaAppPool = Get-SPServiceApplicationPool $ssaAppPoolName ## Start Search Service Instances ## Write-Host "Starting Search Service Instances..." Start-SPEnterpriseSearchServiceInstance $searchServerName Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance $searchServerName ## Create the Search Service Application and Proxy ## Write-Host "Creating Search Service Application and Proxy..." $searchServiceApp = New-SPEnterpriseSearchServiceApplication -Name $serviceAppName -ApplicationPool $ssaAppPoolName -DatabaseName $searchDBName $searchProxy = New-SPEnterpriseSearchServiceApplicationProxy -Name "$serviceAppName Proxy" -SearchApplication $searchServiceApp ## Clone the default Topology (which is empty) and create a new one and then activate it ## Write-Host "Configuring Search Component Topology..." $appserv = Get-SPEnterpriseSearchServiceInstance -Identity $searchServerName Get-SPEnterpriseSearchServiceInstance -Identity $appserv $ssa = Get-SPEnterpriseSearchServiceApplication $newTopology = New-SPEnterpriseSearchTopology -SearchApplication $ssa New-SPEnterpriseSearchAdminComponent -SearchTopology $newTopology -SearchServiceInstance $appserv New-SPEnterpriseSearchCrawlComponent -SearchTopology $newTopology -SearchServiceInstance $appserv New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $appserv New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $appserv New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $appserv New-SPEnterpriseSearchIndexComponent -SearchTopology $newTopology -SearchServiceInstance $appserv Set-SPEnterpriseSearchTopology -Identity $newTopology Write-Host "Search Service Application installation Complete!" ##END SEARCH