Sharepoint Foundation 2013: Create Search Service App

How many of us had a fresh installation of SharePoint Foundation 2013 and tried to create the Search Service App trough Central Admin and didn't find it? I'm sure than more people than only me :)

Once we are in this situation, we have two possible options

  • Use SharePoint Wizard to create Search Service App
  • Use Powershell

The first option I prefer to discard it, obvious is obvious 😛

So, in the next lines I will post the code I use to create Search Service App

We have to type the account used for the AppPools, the name of the search servce application and the name of the AppPool, as it can be seen I the code, it has been take it from other blog (Thanks :))

[string]$farmAcct = "DomAppPool"
[string]$serviceAppName = "SearchServiceApplication"

Function WriteLine
Write-Host -ForegroundColor White “————————————————————–”

# ———————————————————————
Function ActivateAndConfigureSearchService
# Based on this script :

Write-Host -ForegroundColor White ” –> Configure the SharePoint Foundation Search Service -“, $env:computername
Start-SPEnterpriseSearchServiceInstance $env:computername
Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance $env:computername
$appPool = Get-SPManagedAccount -Identity $farmAcct

New-SPServiceApplicationPool -Name AppServicesAppPool -Account $appPool -Verbose
$saAppPool = Get-SPServiceApplicationPool -Identity AppServicesAppPool
$svcPool = $saAppPool
$adminPool = $saAppPool

$searchServiceInstance = Get-SPEnterpriseSearchServiceInstance $env:computername
$searchService = $searchServiceInstance.Service
$bindings = @(“InvokeMethod”, “NonPublic”, “Instance”)
$types = @([string],

$values = @($serviceAppName,

$methodInfo = $searchService.GetType().GetMethod(“CreateApplicationWithDefaultTopology”, $bindings, $null, $types, $null)
$searchServiceApp = $methodInfo.Invoke($searchService, $values)
$searchProxy = New-SPEnterpriseSearchServiceApplicationProxy -Name “$serviceAppName – Proxy” -SearchApplication $searchServiceApp

catch [system.exception]
Write-Host -ForegroundColor Yellow ” ->> Activate And Configure Search Service caught a system exception”
Write-Host -ForegroundColor Red “Exception Message:”, $_.Exception.ToString()


That’s all!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s