k blog.kenaro.com
← All articles

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

· Ingo Karstein

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 comments

Bjorn Jan 6, 2013
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
ikarstein Jan 7, 2013
Just type only one server name in this line. "SearchServer1" | % { Anything else is the same. Regards, Ingo
Bjorn Jan 7, 2013
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
ikarstein Jan 8, 2013
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.
Bjorn Jan 8, 2013
Thanks again ! Works great :D
Omkar Baviskar Apr 10, 2014
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 comment

Your comment is reviewed before it appears. Your name is shown with the comment; your email is required for moderation but never published.