I would like to use code behind to set the search settings of my site:

  • The Site Collection Search Center Url
  • Site Collection Search Dropdown Mode: Show Scopes Dropdown

Any ideas on how to implement this?

1 Answer 1


This is done by modifying properties on the Root Web property bag. Here's a PowerShell sample that I've used to set the same settings on all site collections:

$url = "http://rockingsharepointserver"
Get-SPSite  -Limit ALL | foreach{ 
    IF($_.RootWeb.AllProperties -ne $null) {
        $_.RootWeb.AllProperties["SRCH_SITE_DROPDOWN_MODE"] = "ShowDD"
        $_.RootWeb.AllProperties["SRCH_ENH_FTR_URL"] = "$url/sites/Search/Pages"
        Write-Host -ForeGroundColor blue Updated Search settings for $_.RootWeb.Url

The easiest way to find out what values you should be using is to configure one site collection and then use SharePoint Designer to inspect the properties (Ribbon > Manage > Site Options)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.