Created
March 30, 2014 23:36
-
-
Save ishajain/9881830 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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