Thursday, June 13, 2024

HowTo: create Search Sharepoint 2013 Foundation Application via Powershell

Problem: You deleted the Search Service Application in Sharepoint 2013 Foundation and are now unable to recreate it, as your web application is not named “Sharepoint – 80” (so the wizard will not work).

Solution: Microsoft disabled the option to create the DB via powershell for some reasons, but Gary found a solution to perform the tasks via powershell as mentioned here. Here is the code I´m using (similar to Garys one).

What it does:

– Create a new pool (modify the script if you wish to use a existing one)

– Use a existing Service Taskuser which I added via the central administration

– Create the search application and the proxy

Start-SPEnterpriseSearchServiceInstance $env:computername

Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance $env:computername
$serviceAppName = "Search Service Application"

$appPool=Get-SPManagedAccount -Identity "Contoso\SpFarmSearch"

New-SPServiceApplicationPool -Name SearchApplicationPool -Account $appPool -Verbose

$saAppPool=Get-SPServiceApplicationPool -Identity SearchApplicationPool

$svcPool = $saAppPool

$adminPool = $saAppPool

$searchServiceInstance = Get-SPEnterpriseSearchServiceInstance –Local

$searchService = $searchServiceInstance.Service

$bindings = @(“InvokeMethod”, “NonPublic”, “Instance”)

$types = @([string], [Type],

$values = @($serviceAppName,

$methodInfo = $searchService.GetType().GetMethod(“CreateApplicationWithDefaultTopology”, $bindings, $null, $types, $null)

$searchServiceApp = $methodInfo.Invoke($searchService, $values)

$searchProxy = New-SPEnterpriseSearchServiceApplicationProxy -Name “$serviceAppName Proxy” -SearchApplication $searchServiceApp



Related Articles


Please enter your comment!
Please enter your name here

Stay Connected

- Advertisement -

Latest Articles