I got an interesting request recently to find all search centers configured for all Site Collections. I thought I would share the very simple script to do this:
Get-SPSite -limit all | % { write-host "$($_.url),$($_.rootweb.AllProperties["SRCH_ENH_FTR_URL"])" } |
You can set the search drop down property using this assignment
$web.AllProperties[“SRCH_SITE_DROPDOWN_MODE”] = HideScopeDD_Defaultcontextual |
Here are the possible HideScopeDD_Defaultcontextual Values and what they mean
Site Collection Search Dropdown Mode | Property Value | Search Results URL |
---|---|---|
Do Not Show Scopes Dropdown, and default to contextual scope | HideScopeDD_DefaultContextual | Y |
Do Not Show Scopes Dropdown, and default to target results page | HideScopeDD | N |
Show scopes Dropdown | ShowDD | Y |
Show, and default to ‘s’ URL parameter | ShowDD_DefaultURL | Y |
Show and default to contextual scope | ShowDD_DefaultContextual | Y |
Show, do not include contextual scopes | ShowDD_NoContextual | N |
Show, do not include contextual scopes, and default to ‘s’ URL parameter | ShowDD_NoContextual_DefaultURL | N |
Here’s the full PowerShell script to set these values:
$web = Get-SPWeb http://SharePoint/managedpath/site $web.AllProperties[“SRCH_ENH_FTR_URL”] = “/search/” $web.AllProperties[“SRCH_SITE_DROPDOWN_MODE”] = HideScopeDD_Defaultcontextual $web.AllProperties[“SRCH_TRAGET_RESULTS_PAGE”] =”/_layouts/OSSSearchResults.aspx” $web.update() |
Want to talk?
Drop us a line. We are here to answer your questions 24*7.