SharePoint 2013 Search Center URL update in All Site Collections


When we plan to use a new search center in SharePoint 2013 for a web application, the question arises how to update the site collections with this new Search Center URL and PowerShell seemed the best option and while iterating through all the site collections to update Search Center URL. Make sure the search settings under subsites/webs “Use the same results page setting as my parent” is checked. Then updating the search center url at Site Collection level should work for all the sub sites.

$SPWebApp = Get-SPWebApplication http://webapp.com
foreach ($SPSite in $SPWebApp.Sites)
{
if ($SPSite -ne $null)
{
$web = Get-SPWeb $spsite.Url
$web.AllProperties[“SRCH_SB_SET_SITE”] =  ‘{“Inherit”:false,”ResultsPageAddress”:”/sites/SearchCenter/Pages/results.aspx”,”ShowNavigation”:false}’
$web.AllProperties[“SRCH_ENH_FTR_URL_SITE”] = ‘/sites/SearchCenter/Pages’
$web.Update();
}
}

In the above code make sure you update the full url of the search center if the web app is different for the search center other wise relative path should work.

Reference:

http://stevemannspath.blogspot.in/2013/07/sharepoint-2013-search-setting-all.html

http://radutut.wordpress.com/2013/03/11/update-search-settings-using-powershell-in-sharepoint-2013

http://jshidell.com/2013/01/16/setting-sharepoint-2010-site-collection-search-settings-using-powershell

http://sharepoint.jsturges.com/2012/02/update-search-center-for-all-sites-in-a-web-application

 

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s