Export (0) Print
Expand All

Set-BpaResult

Set-BpaResult

The Set-BPAResult cmdlet allows you to exclude or include existing results of a Best Practices Analyzer (BPA) scan to show you only the scan results that you want to see.

Syntax

Set-BPAResult [-BestPracticesModelId] <string> [-Results] <Result>> [-Exclude] [<CommonParameters>]

Detailed Description

The Set-BPAResult cmdlet allows you to exclude or include existing results of a Best Practices Analyzer (BPA) scan to show you only the scan results that you want to see. The action specified in the cmdlet (Exclude, for example) determines how the existing results of a BPA scan are updated. Set-BPAResult is typically applied after using the Get-BPAResult cmdlet to return a collection of scan results. You can apply filters to results returned by the Get-BPAResult cmdlet, and then pipe the filtered collection of results to the Set-BPAResult cmdlet, specifying either to include or exclude filtered scan results.

Parameters

-BestPracticesModelId <string>

Specifies the command ID of the Best Practices Analyzer model for which you want to modify scan results. Note that the Set-BPAResult cmdlet does not start a new scan. You can also use the short form of the -BestPracticesModelId parameter, -Id.

Attributes

Name Value

Required?

true

Accept wildcard characters?

false

Accept Pipeline Input?

false

Position?

2

-Exclude <SwitchParameter>

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

-Exclude $true

Attributes

Name Value

Required?

false

Accept wildcard characters?

false

Accept Pipeline Input?

false

Position?

3

-Results <Result>>

Specifies the result collection to be updated in the result file returned by the Set-BPAResults cmdlet. The -Results 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 the -Results parameter. For example, if you have created a variable $allPerformance to store all the Performance category results for a BPA scan of all roles on a computer, and you want to exclude those Performance results from the complete collection of scan results, you add the parameter -Results $allPerformance to a Set-BPAResult cmdlet. For more detailed examples, see the Examples section.

Attributes

Name Value

Required?

true

Accept wildcard characters?

false

Accept Pipeline Input?

true (ByValue)

Position?

4

-CommonParameter

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see About Common Parameter

Input and Return Types

The input type is the type of the objects that you can pipe to the cmdlet. The return type is the type of the objects that the cmdlet emits.

Input Type

.

Return Type

.

Notes

  • If the Set-BPAResult command is canceled before the results are written to a file, the operation is canceled and the results file is not modified. If cancellation occurs after the results file has been modified, the command's actions are carried out, and the command cannot be canceled.

Examples

EXAMPLE 1

C:\PS>Get-BPAResult -BestPracticesModelId <Specified Model Id> | Where { $_.Category -eq "Performance" } | Set-BPAResult -Id <Specified Model Id> -Exclude $true

Description

-----------

The first section of the preceding 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 "Specified Model Id." The second section of the command 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.

EXAMPLE 2

C:\PS>$rcPolicy = Get-BPAResult -BestPracticesModelId <Specified Model Id> | Where { $_.Category -eq "Policy" }Set-BPAResult -Id <Specified Model Id> -Exclude $true -Results $rcPolicy

Description

-----------

The first line of the preceding 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 "Specified Model Id." 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 commands to represent those results.

The second line of the command uses the Set-BPAResult cmdlet to exclude the set of results stored in the $rcPolicy variable, for the specified model ID. In this example, 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.

See Also

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft