| I’ve been doing a lot of SharePoint 2013 install webinars lately. Since SharePoint 2010 I’ve been on a personal mission to eradicate nasty GUIDs from all SharePoint databases. When I’m doing my webinars I demonstrate creating the Search service application with PowerShell instead Central Admin. Not because I have anything against Central Admin, it’s a fine web site. But if you create a Search service application in Central Admin you don’t get to specify databases names. And what happens in SharePoint if you don’t specify a database name, SharePoint puts a damned GUID at the end! Grrrrr. So I use PowerShell to create Search, which allows me to specify a database name, and feel a bit better about myself in the process. It’s a win-win! Here is the script that I use. Notice that it is almost completely stolen from my friend Spence Harbar. I grabbed it from this blog post here. If you find this script helpful, buy Spence a drink the next time you see him. Here it is:
# Based on scripts at http://www.harbar.net/articles/sp2013mt.aspx
# Thanks Spence!
# Get App Pool
$saAppPoolName = "Default SharePoint Service App Pool"
# Search Specifics, we are single server farm
$searchServerName = (Get-ChildItem env:computername).value
$serviceAppName = "Search Service Application"
$searchDBName = "SearchService_DB"
# Grab the Appplication Pool for Service Application Endpoint
$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 "Search Done!"
If you don’t want to copy and paste it, you can download it here. The script assumes your farm has a Service App app pool named "Default SharePoint Service App Pool." It also doesn’t do a couple of things. You’ll need to change the default content crawl account. By default Search uses the Farm account, which is a really bad idea. Worse than wearing white after labor day. If you follow my service account guidelines you'll change this to sp_content. You should also specify a default Search Center.
After your Search service application is created you should run a full crawl, even if you don't have any content in your farm yet. This will let you know that everything is configured correctly.
Enjoy,
tk
ShortURL: http://www.toddklindt.com/createsearch2013 |