Use this Knowledge Script to monitor the Windows event log for errors and warnings whose source is BPA (Exchange Best Practices Analyzer). This script raises an event if the Knowledge Script job fails or the event log contains error and warning messages.
If you are not running the BPA, you can use this script to execute the BPA each time the script runs. If you set the Execute Best Practices Analyzer during job? parameter to Yes, AppManager runs the BPA at each iteration of the Knowledge Script job. AppManager then stops the BPA and analyzes the event log for errors and warnings raised by the BPA.
NOTE:
This script may raise duplicate events on computers where multiple Exchange Server 2007 and 2010 roles are installed. These duplicate events are raised because the BPA populates the event log with errors and warnings for each role when the error or warning is applicable for the entire Exchange Server 2007 or 2010 organization.
This script is not applicable for Exchange Server 2013, 2016, and 2019.
Most BPA events do not indicate which role they are associated with. Therefore, this script raises events that are not associated with a role. However, the AppManager event messages include the text of the BPA event, which should help you determine which role is affected.
This script is a member of the Exchange2007 recommended Knowledge Script Group. For more information, see Section 4.43, Recommended Knowledge Script Group.
The BPA must be running so that it can submit any errors or warnings to the event log. This script will not work if you are not running the BPA and do not enable the Execute Best Practices Analyzer during job? parameter.
If you do not enable this script to launch the BPA, then run the ExBPAcmd.exe tool manually to monitor the Windows Event Log for errors and warnings.
To run the ExBPAcmd.exe tool manually:
Open the Exchange Management Shell.
Run the following command:
$exBPAoutput = . "C:\Program Files\Microsoft\Exchange Server\Bin\ExBPAcmd.exe" -p Events:Enable -r "5,$role,$scan_type,Server=<ExchangeServerName>"
where $role is one of the following values enclosed in quotation marks (“ ”): Mailbox, Gateway, Bridgehead, ClientAccess, ClusterMailbox
where $scan_type is one of the following values enclosed in quotation marks (“ ”): Health, ConnectivityTask, Ex2007Readiness, Perf, Permissions
where <ExchangeServerName> is the name of the Exchange server where you want to run the ExBPAcmd.exe tool.
Run the following command to display the output of the ExBPAcmd.exe tool:
Write-Host $exBPAoutput
These commands enable the event log register.
Before running this script, ensure that the following permissions and memberships exist.
Component |
Required Permissions and Memberships |
---|---|
Account running the AppManager agent service (netiqmc) |
|
Exchange Best Practice Analyzer tool (for all Exchange Server roles) |
|
Exchange_Server
By default, this script runs every one hour.
Set the following parameters as needed:
Parameter |
How to Set It |
---|---|
General Settings |
|
Job failure event notification |
|
Event severity when job fails |
Set the severity level, from 1 to 40, to indicate the importance of an event in which the All_BestPracticesAnalyzer job fails. The default is 5. |
Analyze Exchange Server 2007/2010 Best Practices |
|
Execute Best Practices Analyzer during job? |
Select Yes to allow AppManager to launch the BPA using a command-line execution of ExBPACmd.exe at each iteration of this script. If you are already running the BPA, then clear this option. The BPA must be running so that it can submit any errors or warnings to the event log. The default is Yes. |
Type of scan to execute |
Select the type of scan the BPA should perform:
|
Event Notification |
|
Comma-separated list of event IDs to ignore |
Provide a list of error and warning ID numbers that this script should ignore when scanning the event log. Separate the numbers with a comma. |
Raise event for errors found in Windows Event Log? |
Select Yes to raise an event when the event log contains error messages raised by the BPA. The default is Yes. |
Event severity when errors found in the Windows Event Log |
Set the severity level, from 1 to 40, to indicate the importance of an event in which the event log contains error messages. The default is 5. |
Raise event for warnings found in Windows Event Log? |
Select Yes to raise an event when the event log contains warning messages raised by the BPA. The default is Yes. |
Event severity for warnings found in the Windows Event Log |
Set the severity level, from 1 to 40, to indicate the importance of an event in which the event log contains warning messages raised by the BPA. The default is 15. |