Tutorials  PowerShell Cmdlet Help for Invoke-BpaModel


The Invoke-BPAModel cmdlet allows you to start a Best Practices Analyzer (BPA) scan for a specific model that is in
stalled on your computer.

Invoke-BPAModel [-BestPracticesModelId] [[-ArgumentTable] ] []

The Invoke-BPAModel cmdlet allows you to start a Best Practices Analyzer (BPA) scan for a specific model that is in
stalled on your Windows-based computer. The model is specified either by using the parameter BestPracticesModelId,
or by piping the results of the Get-BPAModel cmdlet into an Invoke-BPAModel cmdlet. If a model is specified in the
command, after the BPA scan has been performed, the results of the scan are available as an XML file.

Specifies model-specific instructions with which to start BPA scans. For example, the ArgumentTable parameter c
an allow an administrator to pass parameters to the model as expected by the model author. These arguments, pa
ssed as a set of name-value pairs, change how a BPA scan runs.

Required? false
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false

Specifies the command ID of the Best Practices Analyzer model on which you want to start a scan. You can also u
se the short form of the -BestPracticesModelId parameter, -Id.

Required? true
Position? 2
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false

This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".


The output object encapsulates the results of the cmdlet that you entered. It contains information such as the
BPA model ID, the success or failure of the cmdlet, and other details.


The Invoke-BPAModel cmdlet cannot be canceled after it has been started.

If the cmdlet is used to perform a single-model scan, and the cmdlet is canceled (by using CTRL+C) before the t
emporary results file is copied to its final location, the temporary file is discarded, and any previous scan r
esults file for the role is preserved. The message "Processing of Invoke-BPAModel canceled by user" is displaye
d, if the command is canceled before existing scan results files are overwritten.

If the cmdlet is used to perform a scan of multiple models by piping in results from the Get-BPAModel cmdlet, a
nd the command is canceled, scans that were completed before the cancel command was entered cannot be canceled.
A scan in progress behaves as described above in the single-model scan cancellation scenario. Subsequent scans
in the pipeline are canceled.

-------------------------- EXAMPLE 1 --------------------------

C:\PS>Invoke-BPAModel -BestPracticesModelId

The preceding example starts a BPA scan on the model that is represented by .

Alternatively, you can complete the same task by running either of the two following cmdlets:

Invoke-BPAModel -Id

- OR -


-------------------------- EXAMPLE 2 --------------------------

C:\PS>Invoke-BPAModel -ArgumentTable @{context=domain; name=redmond.microsoft.com;}

This example starts a BPA scan on the specified model ID. The -ArgumentTable parameter helps the administrator star
t a BPA scan with additional model-specific instructions; for example, by using the -ArgumentTable parameter on a m
odel which requires other model parameters (context and name, for examples) to be passed to it, the administrator c
an specify the values of these model parameters by using the ArgumentTable parameter.

-------------------------- EXAMPLE 3 --------------------------

C:\PS>Get-BPAModel | Invoke-BPAModel

The preceding example gets all BPA models that are installed on the computer, and then pipes the results of the Get
-BPAModel cmdlet to Invoke-BPAModel to start a BPA scan on all models.

-------------------------- EXAMPLE 4 --------------------------

C:\PS>$BPAObj = Invoke-BPAModel

ModelId :
Success : True
ScanTime : 10/21/2008 3:08:47 PM
InformationMessages : 5
WarningMessages : 4
ErrorMessages : 0
Description :

In the preceding example, the Invoke-BPAModel cmdlet starts a BPA scan on the model specified by Specified Model Id
, and saves the results of the command as a variable, BPAObj.

The second line of the command allows the administrator to view results of any specific object in the first line of
the cmdlet by calling the variable into which the entire first line's results were saved, and then specifying the
following: which object's results the administrator wants (in this example, the 0, or first, object), and which fi
eld of the results of that object (in this example, the Detail field) the administrator wants to view. The example
shown returns the Detail field results of the Invoke-PAModel cmdlet that is run in the first line.

Online version: http://go.microsoft.com/fwlink/?LinkId=141491