Set-BpaResult

Set-BpaResult

Excludes or includes existing results of a Best Practices Analyzer (BPA) scan to display only the specified scan results.

구문

Parameter Set: Default
Set-BpaResult [[-Exclude] <Boolean> ] [-Results] <List<Result>> [[-RepositoryPath] <String> ] [ <CommonParameters>]

자세한 설명

The Set-BPAResult cmdlet excludes or includes existing results of a Best Practices Analyzer (BPA) scan to display only the specified scan results. The action specified in this cmdlet (such as Exclude) determines how the existing results of a BPA scan are updated. This cmdlet is typically applied after using the Get-BpaResult cmdlet to return a collection of scan results. Filters can be applied to results returned by the Get-BpaResult cmdlet, and then pipe the filtered collection of results to this cmdlet, specifying either to include or exclude filtered scan results.

This will update the results in the result file with the specified result collection with the action specified. The administrator would generally need to call the Get-BpaResult cmdlet prior to this to get the result collection, apply some filters and pipe the collection to this cmdlet specifying the action (exclusion or inclusion).

If this cmdlet is canceled before the results are written to a file, then the operation is canceled and the results file is not modified. If cancellation occurs after the results file has been modified, then the actions of the cmdlet are carried out, and the cmdlet cannot be canceled.

매개 변수

-Exclude<Boolean>

Removes any BPA scan results that are specified by a filter added to this cmdlet. The Exclude action applies to all results returned by this cmdlet. To exclude results by using this parameter, add the value $true following the parameter, as shown:
- -Exclude $true

별칭

없음

필수 여부

false

위치

2

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-RepositoryPath<String>

Specifies the location where the report should be stored.
The Invoke-BpaModel cmdlet provides an option to store the results either in the default reports repository location referred by ReportsRoot registry key or in a custom location supplied as input to this parameter.

별칭

없음

필수 여부

false

위치

4

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-Results<List<Result>>

Specifies the result collection to be updated in the result file returned by this cmdlet. This parameter is typically used to specify a filtered subset of scan results that has already been stored in a variable; the variable name is provided as the valid value for this parameter.
This is the result collection which needs to be updated in the result file.
Example: if a variable named $allPerformance is created to store all the Performance category results for a BPA scan of all roles on a computer, and to exclude those Performance results from the complete collection of scan results, add the following parameter to this cmdlet.
- -Results $allPerformance

별칭

없음

필수 여부

true

위치

3

기본값

없음

파이프라인 입력 적용 여부

True (ByValue)

와일드카드 문자 허용 여부

false

<CommonParameters>

이 cmdlet은 일반 매개 변수 -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer 및 -OutVariable을 지원합니다. 자세한 내용은 다음을 참조하세요. about_CommonParameters(https://go.microsoft.com/fwlink/p/?LinkID=113216).

입력

입력 유형은 cmdlet에 파이프할 수 있는 개체의 유형입니다.

  • System.Collections.Generic.List<Microsoft.BestPractices.CoreInterface.Result>

    The input object specified by the Results parameter.

출력

출력 유형은 cmdlet이 내보내는 개체의 유형입니다.

  • None

예제

EXAMPLE 1

This example, to the left of the first pipe character (|), uses the Get-BpaResult cmdlet to retrieve Best Practices Analyzer scan results for the model ID represented by ModelId1. The second section of the cmdlet filters the results of the Get-BpaResult cmdlet to get only those scan results for which the category name is equal to Performance. The final section of the example, following the second pipe character, excludes the Performance results filtered by the previous section of the example.

PS C:\> Get-BPAResult -ModelId ModelId1 | Where-Object -FilterScript { $_.Category -Eq "Performance" } | Set-BPAResult -ModelId ModelId1 -Exclude $true

EXAMPLE 2

This example, to the left of the pipe character (|), instructs the Get-BpaResult cmdlet to retrieve Best Practices Analyzer scan results for the model represented by ModelId1 The second section of the example, after the pipe character, filters the results of the Get-BpaResult cmdlet to return only those scan results for which the category name is equal to (note the Eq option) Policy.

The variable $rcPolicy is created to store the filtered results of the Get-BpaResult cmdlet; this variable can be used in subsequent cmdlets to represent those results.

PS C:\> $rcPolicy = Get-BPAResult -ModelId ModelId1 | Where-Object –FilterScript { $_.Category -Eq "Policy" }

The second line of the example uses this cmdlet to exclude the set of results stored in the $rcPolicy variable, for the specified model ID. In this cmdlet, the Results parameter is added because the administrator wants to exclude a specific subset of scan results for that model, and has created the variable $rcPolicy to represent that subset of results.

PS C:\> Set-BPAResult -ModelId ModelId1 -Exclude $true -Results $rcPolicy

관련 항목

Get-BpaModel

Get-BpaResult

Invoke-BpaModel

Where-Object