Search Results for

    Show / Hide Table of Contents

    Test-SearchRule

    Tests specified paths against the search rules of a search catalog.

    Syntax

    Test-SearchRule
        [-Path] <String[]>
        [-IsIncluded]
        [-Catalog <String>]
        [<CommonParameters>]
    
    Test-SearchRule
        [-Path] <String[]>
        -HasChildScope
        [-Catalog <String>]
        [<CommonParameters>]
    
    Test-SearchRule
        [-Path] <String[]>
        -HasParentScope
        [-Catalog <String>]
        [<CommonParameters>]
    
    Test-SearchRule
        [-Path] <String[]>
        -Detailed
        [-Catalog <String>]
        [<CommonParameters>]
    

    Description

    The Test-SearchRule cmdlet tests specified paths against the search rules of a search catalog.

    Examples

    Example 1: Test if a path is included

    Test-SearchRule -Path file:///C:\Users\Bob\Drafts\
    
    True
    

    This command checks if the specified path is included in the default Windows Search catalog.

    For file system paths, you can omit the file:/// protocol prefix.

    Example 2: Test a path and get detailed results

    Test-SearchRule -Path C:\Users\Bob\Drafts\ -Detailed
    
    Path                  : C:\Users\Bob\Drafts
    IsIncluded            : True
    Reason                : CLUSIONREASON_DEFAULT
    HasChildScope         : True
    HasParentScope        : False
    ParentScopeVersiondId : 1
    

    This command gets details about the inclusion or exclusion of the specified path.

    Parameters

    -Catalog

    Specifies the name of the catalog this cmdlet operates on. If omitted, this is the default Windows Search catalog, named SystemIndex.

    Type

    string

    Position

    Named

    Default value

    SystemIndex

    Accept pipeline input

    False

    Accept wildcard characters

    False

    -Detailed

    Use this parameter to return detailed results.

    Type

    SwitchParameter

    Position

    Named

    Default value

    None

    Accept pipeline input

    False

    Accept wildcard characters

    False

    -HasChildScope

    Use this parameter to check if the specified path has child search rules.

    Type

    SwitchParameter

    Position

    Named

    Default value

    None

    Accept pipeline input

    False

    Accept wildcard characters

    False

    -HasParentScope

    Use this parameter to check if the specified path has parent search rules.

    Type

    SwitchParameter

    Position

    Named

    Default value

    None

    Accept pipeline input

    False

    Accept wildcard characters

    False

    -IsIncluded

    Use this parameter to check if the specified path is included in the search catalog.

    Type

    SwitchParameter

    Position

    Named

    Default value

    None

    Accept pipeline input

    False

    Accept wildcard characters

    False

    -Path

    Specifies the URL or path to be tested.

    Type

    string[]

    Position

    0

    Default value

    None

    Accept pipeline input

    True (ByPropertyName, ByValue)

    Accept wildcard characters

    False

    Inputs

    string[]

    You can pipe paths to this cmdlet.

    Outputs

    bool

    When you use the IsIncluded, HasChildScope, or HasParentScope parameters, the cmdlet returns a Boolean value for each tested path.

    TestSearchRuleInfo

    When you use the Detailed parameter, the cmdlet returns an TestSearchRuleInfo object for each tested path.

    Notes

    To learn more about search rules, see Managing Scope Rules in Microsoft's Windows Search documentation.

    Related Links

    • Add-SearchRule

    • Get-SearchRule

    • Remove-SearchRule

    • Reset-SearchRule

    In this article
    Back to top Copyright © 2023 Matthias Wolf, Mawosoft