Post

Exclude users from SharePoint search results using crawl rules
We are using the default AD import for an environment to crawl user profiles. The customer requested the ability to exclude some users from the search results. This can be done by changing the search web part to exclude these users or by changing the user profile synchronization or by excluding these profiles using crawl […]

We are using the default AD import for an environment to crawl user profiles. The customer requested the ability to exclude some users from the search results. This can be done by changing the search web part to exclude these users or by changing the user profile synchronization or by excluding these profiles using crawl rules. This blog shows you how to exclude users from SharePoint search results using crawl rules.

I’ve 4 accounts at this environment which I can query using the SharePoint Search Query Tool.

You will have to go to the Central Administration and then to the search administration.

Click on “Crawl Rules” under Crawling

Next click on “New Crawl Rule”

Add the correct path which is normally https://<MySitesHostURL>:<PortNumber>/person.aspx[?]accountname=<Domain>%5C<LoginName>
On my test environment this would be: https://mysites.sharepointfire.com:443/person.aspx[?]accountname=spfire%5Cmpadmin

Select “Use regular expressions…” and “Exclude complex URLs…” and click on OK

Next start a full crawl on the content source where you configured the people search (I suggest creating a content source just for the people search) and afterwards the user will be no longer queryable using search which can also be verified in the crawl log.and the SharePoint Search Query Tool

There is also a PowerShell command to create these exclusions automatically based for example on a property from Active Directory which can be found at https://docs.microsoft.com/en-us/powershell/module/sharepoint-server/new-spenterprisesearchcrawlrule?view=sharepoint-ps

 

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Archive