Experienced a fail during a 2013 installation. Had previously installed on the same server, uninstalled SP2013 and deleted DB’s. When reinstalling script failed at creating the Search Index as files from the previous installation still existed.
_System.Management.Automation.ParameterBindingException: Cannot bind parameter ‘RootDirectory’
to the target. Exception setting “RootDirectory”: “___New index location must be empty___” —>
System.Management.Automation.SetValueInvocationException: Exception setting “RootDirectory”:
“New index location must be empty” —> System.ArgumentException: New index location must be
The work-around may not be quite that simple. I got this same error using PowerShell to create the search topology. I tried to delete the contents of the index location. I found files in that folder were in use by SharePoint so could not so easily delete them. Even when I force-cleared out the index folder, I could not get the index folder to remain empty long enough to run the New-SPEnterpriseSearchIndexComponent cmdlet, which is the line in the PowerShell that takes the -RootDirectory parameter and returns this error message.
I suspect the Search Host Controller Service got the index location from some SharePoint registry entry or DB record that got set way back in SharePoint Setup, because when running SharePoint setup on the Search server — in the Server Type page — I foolishly clicked the “File Location” tab and selected the index location like it says to do.
Here’s how I resolved the issue:
1. From Central Administration, navigate to Services on server.
2. From the Services on Server page, use the Server: prompt in the upper right corner to select Change Server and select your search server
3. From the Services on Server page, scroll down and locate __Search Host Controller Service__ and click __Stop__
4. Go back to your Search Server and delete everything out of the folder at the Search Index location.
5. With the Search Host Controller service still stopped, re-run the PowerShell script you are using that includes the New-SPEnterpriseSearchIndexComponent command.
Interestingly, I found the Search Host Controller Service started running again automatically and I did not have to go back to Central Administration to re-start it.