Sharepoint has provided an easy approach through Central admin to enable Search service application, but the one known issue with it is, it creates a database on its own. we can also enable this using powershell commands. By doing this, we can provide our own name for the DB.
Below is the step by step commands to be executed to enable Search service using powershell.
Below is the step by step commands to be executed to enable Search service using powershell.
#Add-PSSnapin Microsoft.SharePoint.PowerShell
# 1.Setting up some initial variables.
write-host 1.Setting up some initial variables.
$SSAName = "InternalSearch"
$SSADatabase = "InternalSearchDB"
$saAppPoolName = "SecurityTokenServiceApplicationPool"
$SSI = get-spenterprisesearchserviceinstance -local
$err = $null
# Start Services search services for SSI
write-host Start Services search services for SSI
Start-SPEnterpriseSearchServiceInstance -Identity $SSI
Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance $SSI
# 2.connect to an Application Pool.
write-host 2.connect to an Application Pool.
$AppPool = Get-SPServiceApplicationPool $saAppPoolName
# 3.Create the SearchApplication and set it to a variable
write-host 3.Create the SearchApplication and set it to a variable
$SearchApp = New-SPEnterpriseSearchServiceApplication -Name $SSAName -applicationpool $AppPool -databasename $SSADatabase
#4 Create search service application proxy
write-host 4 Create search service application proxy
$SSAProxy = new-spenterprisesearchserviceapplicationproxy -name $SSAName" ApplicationProxy" -Uri $SearchApp.Uri.AbsoluteURI
# 5.Provision Search Admin Component.
write-host 5.Provision Search Admin Component.
set-SPenterprisesearchadministrationcomponent -searchapplication $SearchApp -searchserviceinstance $SSI
# 6.Create a new Crawl Topology.
write-host 6.Create a new Crawl Topology.
$CrawlTopo = $SearchApp | New-SPEnterpriseSearchCrawlTopology
# 7.Create a new Crawl Store.
write-host 7.Create a new Crawl Store.
$CrawlStore = $SearchApp | Get-SPEnterpriseSearchCrawlDatabase
# 8.Create a new Crawl Component.
write-host 8.Create a new Crawl Component.
New-SPEnterpriseSearchCrawlComponent -CrawlTopology $CrawlTopo -CrawlDatabase $CrawlStore -SearchServiceInstance $SSI
# 9.Activate the Crawl Topology.
write-host 9.Activate the Crawl Topology.
do
{
$err = $null
$CrawlTopo | Set-SPEnterpriseSearchCrawlTopology -Active -ErrorVariable err
if ($CrawlTopo.State -eq "Active")
{
$err = $null
}
Start-Sleep -Seconds 10
}
until ($err -eq $null)
# 10.Create a new Query Topology.
write-host 10.Create a new Query Topology.
$QueryTopo = $SearchApp | New-SPenterpriseSEarchQueryTopology -partitions 1
# 11.Create a variable for the Query Partition
write-host 11.Create a variable for the Query Partition
$Partition1 = ($QueryTopo | Get-SPEnterpriseSearchIndexPartition)
# 12.Create a Query Component.
write-host 12.Create a Query Component.
New-SPEnterpriseSearchQueryComponent -indexpartition $Partition1 -QueryTopology $QueryTopo -SearchServiceInstance $SSI
# 13.Create a variable for the Property Store DB.
write-host 13.Create a variable for the Property Store DB.
$PropDB = $SearchApp | Get-SPEnterpriseSearchPropertyDatabase
# 14.Set the Query Partition to use the Property Store DB.
write-host 14.Set the Query Partition to use the Property Store DB.
$Partition1 | Set-SPEnterpriseSearchIndexPartition -PropertyDatabase $PropDB
# 15.Activate the Query Topology.
write-host 15.Activate the Query Topology.
do
{
$err = $null
$QueryTopo | Set-SPEnterpriseSearchQueryTopology -Active -ErrorVariable err -ErrorAction SilentlyContinue
Start-Sleep -Seconds 10
if ($QueryTopo.State -eq "Active")
{
$err = $null
}
}
until ($err -eq $null)
Write-host "Your search application $SSAName is now ready"
No comments:
Post a Comment