First of all, I have to admit, I owe a beer to both Todd and Spence for the script, I use the very same for deploying Search in SharePoint 2013:
# Get App Pool
$saAppPoolName = “SharePoint Service App Pool”
# Search Specifics, on single server farm
$searchServerName = (Get-ChildItem env:computername).value
$serviceAppName = “Demo Search Service Application”
$searchDBName = “DEMO_SearchService_DB”
# Grab the Appplication Pool for Service App
$saAppPool = Get-SPServiceApplicationPool $saAppPoolName
# 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 $saAppPoolName -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…”
$clone = $searchServiceApp.ActiveTopology.Clone()
$searchServiceInstance = Get-SPEnterpriseSearchServiceInstance
New-SPEnterpriseSearchAdminComponent –SearchTopology $clone -SearchServiceInstance $searchServiceInstance
New-SPEnterpriseSearchContentProcessingComponent –SearchTopology $clone -SearchServiceInstance $searchServiceInstance
New-SPEnterpriseSearchAnalyticsProcessingComponent –SearchTopology $clone -SearchServiceInstance $searchServiceInstance
New-SPEnterpriseSearchCrawlComponent –SearchTopology $clone -SearchServiceInstance $searchServiceInstance
New-SPEnterpriseSearchIndexComponent –SearchTopology $clone -SearchServiceInstance $searchServiceInstance
New-SPEnterpriseSearchQueryProcessingComponent –SearchTopology $clone -SearchServiceInstance $searchServiceInstance
$clone.Activate()
Write-Host “Done!”
One might ask, what about the Search DB names?
If you create your Search Service Application (SSA) on the Central Administration, there’s no option for customizing the DB names, and you’ll end up with something like this (each ending with a GUID):
The problem with this is that it’s not “admin friendly” at all. If you happen to have a SQL server hosting the DBs of more than one SharePoint farm, it’ll be a nightmare to figure out which DB goes to which farm.
One option is to prefix the SSA’s name with the farm/server’s name, like “DEMO2013 Search Service App”, as the DB names are based on the SSA’s name. If you give unique names to your SSAs on the different farms, you’re one step closer to be able to recognize your DBs.
In PowerShell above, you can see there’s only one DB name (see highlighted). Other DBs (AnalyticsReportingStoreDB, CrawlStoreDB, LinksStoreDB) will take care of themselves, and will get the very same prefix as your SSA DB. And there’re no GUID postfixes:
Leave a Reply