Domanda

This is what we do to remove a rule from a search scope:

$scope = Get-SPEnterpriseSearchQueryScope -Identity $scope -SearchApplication $ssa;
Get-SPEnterpriseSearchQueryScopeRule -Scope $scope -Url $rule | Remove-SPEnterpriseSearchQueryScopeRule -Url $rule -Confirm:$false;

This is working perfectly for rules of type "Folder". See the sceenshot.

enter image description here

Now, I would like to do the same with rule of type "Domain". See the screenshot again:

enter image description here

Thank you very much.

È stato utile?

Soluzione

I did not find any solution online so I tried to do something that seems to work. However, I feel like this is a dirty solution but it is the only one I found.

$ssa = "Search Service Appilcation Name";
$rule = "domain.stackexchange.whatever";
$scope = Get-SPEnterpriseSearchQueryScope -Identity $scope -SearchApplication $ssa;
$rules = $scope.rules;
$ruleToDelete = $rules | where {$_.MatchingString -eq $rule};
$rule.delete();
$scope.update();
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top