Short Note About Error While Creating Search Service Application for SharePoint 2013 by PowerShell: “Value cannot be null. Parameter name: indexLocation”

Today I got an error while creating a Search Service Application for SharePoint 2013:

PS C:\> $SearchSA = New-SPEnterpriseSearchServiceApplication –Name “Enterprise Search Service Application” –ApplicationPool “Search App Pool” –DatabaseName “Search”

New-SPEnterpriseSearchServiceApplication : Value cannot be null.
Parameter name: indexLocation

To resolve this I just started the Search Service Instance on each (search) server in the farm and set it’s “DefaultIndexLocation” property.

After that I could create the Search Service App.

PS snippet:

"SearchServer1", "SearchServer2" | % {
    $svcInst = (Get-SPServer -Identity $_).serviceinstances | ? { $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceInstance" }
    $svcInst.DefaultIndexLocation = $defaultIndexLocation
    $svcInst.Update()
    $svcInst.Provision()
}

This did it.

6 thoughts on “Short Note About Error While Creating Search Service Application for SharePoint 2013 by PowerShell: “Value cannot be null. Parameter name: indexLocation”

  1. Hi Ingo,

    I got the same error message when trying to install the search service via PS.
    I have 1 App server where I am trying to setup search.

    Im not an expert on Powershell yet:p
    What would the code be for just one search server named?

    Thanks in advanced, im just stuck on this:s

    Best regards Bjorn

  2. Hi Thanks for your reply!

    One mor equestion:-)
    FullName -eq “Microsoft.Office.Server.Search.Administration.SearchServiceInstance”
    This fullname is this a default name or did you choose it?

    br

    Bjorn

  3. This is the type name out of the assemlby. It will “always” be the same. So also on a system with language pack this would work because the type name is not localized.

  4. I am running your commands, not in PS1 but seperately. When I use $svcInst.DefaultIndexLocation = $defaultIndexLocation i get following error
    “Property ‘DefaultIndexLocation’ cannot be found on this object; make sure it exists and is settable.”

    I checked $svcInst object and did not find DefaultIndexLocation method in it.

    Please Help

Leave a Reply

Your email address will not be published. Required fields are marked *