Skip to content

SPSearchCrawlRule

dscbot edited this page Apr 14, 2025 · 19 revisions

Parameters

Parameter Attribute DataType Description Allowed Values
Path Key String The name of the search service application
ServiceAppName Required String The name of the search service application
AuthenticationCredentials Write PSCredential The credentials used for this crawl rule (used for types BasicAccountRuleAccess and NTLMAccountRuleAccess)
AuthenticationType Write String Authentication type used by the crawl rule DefaultRuleAccess, BasicAccountRuleAccess, CertificateRuleAccess, NTLMAccountRuleAccess, FormRuleAccess, CookieRuleAccess, AnonymousAccess
CertificateName Write String The certificate used for this crawl rule (used for type CertificateRuleAccess)
CrawlConfigurationRules Write StringArray[] The configuration options for this rule FollowLinksNoPageCrawl, CrawlComplexUrls, CrawlAsHTTP
Ensure Write String Present if the crawl rule should exist, absent if it should not Present, Absent
RuleType Write String The type of the rule InclusionRule, ExclusionRule

Description

Type: Distributed Requires CredSSP: No

This resource is responsible for managing the search crawl rules in the search service application. You can create new rules, change existing rules and remove existing rules.

The default value for the Ensure parameter is Present. When not specifying this parameter, the crawl rule is created.

Examples

Example 1

This example shows how to apply settings to a sepcific URL in search

Configuration Example
{
    param
    (
        [Parameter(Mandatory = $true)]
        [PSCredential]
        $SetupAccount
    )

    Import-DscResource -ModuleName SharePointDsc

    node localhost
    {
        SPSearchCrawlRule IntranetCrawlAccount
        {
            Path                    = "https://intranet.sharepoint.contoso.com"
            ServiceAppName          = "Search Service Application"
            Ensure                  = "Present"
            RuleType                = "InclusionRule"
            CrawlConfigurationRules = "FollowLinksNoPageCrawl", "CrawlComplexUrls", "CrawlAsHTTP"
            AuthenticationType      = "DefaultRuleAccess"
            PsDscRunAsCredential    = $SetupAccount
        }
    }
}

Example 2

This example shows how to set a certificate for authentication to a content source

Configuration Example
{
    param
    (
        [Parameter(Mandatory = $true)]
        [PSCredential]
        $SetupAccount
    )

    Import-DscResource -ModuleName SharePointDsc

    node localhost
    {
        SPSearchCrawlRule IntranetCrawlAccountCertificate
        {
            Path                    = "https://intranet.sharepoint.contoso.com"
            ServiceAppName          = "Search Service Application"
            Ensure                  = "Present"
            RuleType                = "InclusionRule"
            CrawlConfigurationRules = "FollowLinksNoPageCrawl", "CrawlComplexUrls", "CrawlAsHTTP"
            AuthenticationType      = "CertificateRuleAccess"
            CertificateName         = "Certificate Name"
            PsDscRunAsCredential    = $SetupAccount
        }
    }
}

Clone this wiki locally