Creating a site-level search scope using Powershell RRS feed

  • Question

  • I have adapted the following script from the Technet library in an effort to create a site-level search scope using Powershell:

    New-SPEnterpriseSearchQueryScope -SearchApplication "<SearchApplication>" -Name <ScopeName> -Description "<ScopeDescription>"
    -DisplayInAdminUI 1 -OwningSiteUrl "<OwningSiteURL>"
    $scope = Get-SPEnterpriseSearchQueryScope -SearchApplication "<SearchApplication>" " -Identity "<ScopeName>"
    $scope.Filter = 'site:or("<ScopeSite1URL>", "<ScopeSite2URL>"'

    However, this script creates the scope at the search service application level and NOT at the site level. I think it may have something to do with the fact that the command starts with 'New-SPEnterpriseSearchQueryScope' - which sounds like a service application level.

    Can anyone offer advice on what needs to be changed to ensure the scope is only created at the site level (although I know this is easier enough to manage via the GUI)




    Friday, August 5, 2011 10:22 AM

All replies

  • Hi!

    According to technet the only difference when creating a scope for the application or the site is the parameter -OwningSiteUrl "<OwningSiteURL>".

    And you are right, it is created and handled by the service application in both cases. The difference is that a site level scope is made available for a site while a scope that is not is available to all sites.

    So they are all being created and managed by the service, but handled a bit differently.

    Best regards Gunnar

    • Proposed as answer by Gunnar Braaten Friday, August 5, 2011 11:48 AM
    Friday, August 5, 2011 11:48 AM