Create Enterprise Search Center in SharePoint using PowerShell
What is Search Center in SharePoint?
Search Center site in SharePoint provides an interface for users to submit search queries and get search results similar to any other search engine. A Search Center site is typically a top-level site of a site collection that provides a central search facility.
How to Create Search Center Site Collection?
Creating a search center is quite straightforward. Key it: Select Search Center template while creating site collection/subsite to create search center in SharePoint 2016. You can create a search center either with an Enterprise Search Center template or a Basic Search Center template.
Basic Search Center vs. Enterprise Search Center:
The difference between the Enterprise Search Center template and the Basic Search Center template is the ability to customize the user experience. In an Enterprise Search Center, you can create your own site pages, whereas, in a Basic Search Center, search results are displayed on a system page that we cannot customize. You can only edit the search and search result pages that the template delivers.
Prior to creating an Enterprise Search Center, you must enable the SharePoint Server Standard Site Collection and the SharePoint Server Standard Publishing infrastructure features. Creating a Search center site involves these three steps:
- Create a new web application (optional, but preferred)
- Create a Search Center site collection.
Open the SharePoint 2016 Central Administration site >> Application Management >> Create a new web application and top-level site collection with enterprise search center template.
SharePoint 2013: create enterprise search center using PowerShell:
This PowerShell script creates a new web application and enterprise search center site collection.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Define Variables for Web Application Creation
$WebAppName = "Crescent Search Center"
$HostHeader = "search.crescent.com"
$WebAppURL = "https://" + $HostHeader
$WebAppPort = "80"
$ContentDBName = "Crescent_Search_Content"
$AppPoolName = "Crescent Search Web Application App Pool"
$AppPoolAccount = "Crescent\SP16_Pool"
$FarmAdminAccount = "Crescent\SP16_Farm"
#Authentication Provider
$AuthProvider = New-SPAuthenticationProvider
#Check if Managed account is registered already
Write-Host -ForegroundColor Yellow "Checking if the Managed Accounts already exists"
$AppPoolAccount = Get-SPManagedAccount -Identity $AppPoolAccount -ErrorAction SilentlyContinue
if ($AppPoolAccount -eq $null)
{
Write-Host "Please Enter the password for the Service Account..."
$AppPoolCredentials = Get-Credential $AppPoolAccount
$AppPoolAccount = New-SPManagedAccount -Credential $AppPoolCredentials
}
#Create new Web Application
New-SPWebApplication -name $WebAppName -port $WebAppPort -hostheader $HostHeader -URL $WebAppURL -ApplicationPool $AppPoolName -ApplicationPoolAccount (Get-SPManagedAccount $AppPoolAccount) -AuthenticationMethod NTLM -AuthenticationProvider $AuthProvider -DatabaseName $ContentDBName
#Create Enterprise Search Center site collection
New-SPSite -Name $WebAppName -Url $WebAppURL -Template "SRCHCEN#0" -OwnerAlias $FarmAdminAccount -ContentDatabase $ContentDBName
Next step: Configure search center permissions
Once the search center site is created, you must grant permission to all users in the organization to access the search center site.Â
- Go to : Site Settings >> Site Permissions >> Enterprise Search Visitors Group >> Add “Everyone”