Remove domain web adress rule in search scope using powershell?
-
16-12-2020 - |
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.
Now, I would like to do the same with rule of type "Domain". See the screenshot again:
Thank you very much.
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