Search Service with multiple Content Sources causes errors when rerunning AutoSPInstaller

Sep 19, 2013 at 10:16 AM
Edited Sep 19, 2013 at 11:10 AM
Hi, I have a Sharepoint 2013 installation where I have added a couple of Content Sources in addition to "Local Sharepoint sites".

When rerunning AutoSPInstaller the script tries to set the start addresses of all the Content Sources, and I get the following errors (with proper server names instead of ....) for Set-SPEnterpriseSearchCrawlContentSource: "Protocol for the start-address: http://..../ doesn't match the content source type." and "Object http://..../ already exists.".

It is caused because the line 4156 in my version of AutoSPInstallerFunctions.ps1 assumes that you only have one Content Source:
Get-SPEnterpriseSearchServiceApplication | Get-SPEnterpriseSearchCrawlContentSource | Set-SPEnterpriseSearchCrawlContentSource -StartAddresses $crawlStartAddresses
Get-SPEnterpriseSearchCrawlContentSource retrieves all content sources, and then the script tries to set the StartAddresses of all content sources to $crawlStartAddresses.

I suggest changing the line to in order to accomodate for multiple Content Sources
Get-SPEnterpriseSearchServiceApplication | Get-SPEnterpriseSearchCrawlContentSource | Where-Object {$_.Name -eq "Local SharePoint sites"} | Set-SPEnterpriseSearchCrawlContentSource -StartAddresses $crawlStartAddresses
Is this the right place for such a suggestion, and does it look ok?

Thanks, Gunnar