Set-BpaResult is accessible with the help of BestPractices module. To configure BestPractices, go through this link.


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


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.



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
Default value:None
Accept pipeline input:False
Accept wildcard characters:False


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.

Default value:None
Accept pipeline input:False
Accept wildcard characters:False


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
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False


Set-BpaResult [[-Exclude] <Boolean>] [-Results] <System.Collections.Generic.List`1[Microsoft.BestPractices.CoreInterface.Result]> [[-RepositoryPath] <String>] [<CommonParameters>]

——————–EXAMPLE 1——————–
PS C:>Get-BPAResult -ModelId ModelId1 | Where-Object -FilterScript { $_.Category -Eq “Performance” } | Set-BPAResult -ModelId ModelId1 -Exclude $true
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.

You can check the Version, CommandType and Source of this cmdlet by giving below command.

Get-Command Set-BpaResult

Get-Command Set-BpaResult powershell script command cmdlet bpa practices

You can also read about

To know more PowerShell cmdlets(Commands) on BestPractices click here

Click on this Link for an Single place where you get all the PowerShell cmdlet sorted based on the modules.

You can also refer other blogs on PowerShell at link

You can also refer other blogs on Microsoft at link

And also if you required any technology you want to learn, let us know below we will publish them in our site

Like our page in Facebook and follow us for New technical information.

References are taken from Microsoft

Leave a Reply

Your email address will not be published. Required fields are marked *