Skip to content

Instantly share code, notes, and snippets.

@ishajain
Created March 30, 2014 23:36
Show Gist options
  • Select an option

  • Save ishajain/9881830 to your computer and use it in GitHub Desktop.

Select an option

Save ishajain/9881830 to your computer and use it in GitHub Desktop.
Write-Host "Settings results page for search centre for your site" -ForegroundColor Yellow
$SEARCH_SETTINGS_PROPERTY_NAME = "SRCH_SB_SET_WEB"
$settingsObj = @{}
$settingsObj.Inherit = $false
$settingsObj.ResultsPageAddress = "/searchcentre/pages/results.apsx"
$settingsObj.ShowNavigation = $false
$settingsObjAsJSON = ConvertTo-Json $settingsObj -Compress
if (!$web.AllProperties.ContainsKey($SEARCH_SETTINGS_PROPERTY_NAME))
{
Write-Host "- adding new entry " -ForegroundColor Yellow -NoNewline
$web.AllowUnsafeUpdates = $true
$web.AddProperty($SEARCH_SETTINGS_PROPERTY_NAME, $settingsObjAsJSON)
$web.Update()
}
else
{
Write-Host "- updating entry " -ForegroundColor Yellow -NoNewline
$web.AllowUnsafeUpdates = $true
$web.SetProperty($SEARCH_SETTINGS_PROPERTY_NAME, $settingsObjAsJSON);
$web.Update()
}
Write-Host "Results page for search centre for your site is set succesfully" -ForegroundColor Green
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment