Command-Line Utility for the Best Practices Analyzer Tool
You can perform the same scans at a command prompt that you can by using the graphical user interface (GUI) version of the Best Practices Analyzer tool for Team Foundation Server. For example, you might scan your deployment at set intervals by running the command-line tool as part of an automated script. In some cases, a product-support technician might instruct you to run the command-line tool to help you solve a problem.
The command-line tool collects and analyzes data. As it collects data, the tool performs the following functions:
Queries the computers (TargetComputer) to retrieve the information that is required by the tests that you specified for the scan (TestType).
Writes the information that the tool collects to output data files. For information about these files, see Reports that the Best Practices Analyzer Tool Generates.
During analysis, the tool processes the data that it collects based on the test rules. For more information, see Rule Checking Performed by the Best Practices Analyzer Tool.
After you install the GUI version, you can locate the command-line tool TfsBpaCmd.exe in Drive:/Program Files/Microsoft Team Foundation Server Best Practices Analyzer.
If you specify no parameters, the command-line tool collects data from the local computer based on all rules in the health check.
To use the TfsBpaCmd.exe command, you must be a member of the Team Foundation Administrators security group on the application-tier server for Team Foundation and a member of the sysadmin security group on the computers that are being scanned. For more information, see Prerequisites for Using the Best Practices Analyzer Tool.
Even if you are logged on with administrative credentials, you must open an elevated Command Prompt to perform this function on a server that is running Windows Server 2008. To open an elevated Command Prompt, click Start, right-click Command Prompt, and click Run as administrator. For more information, see the Microsoft Web site.
Specifies the configuration XML file that determines the rules to check as the tool collects data. By default, the tool uses TfsBpa.Config.xml, which is located in Drive:/Program Files/Microsoft Team Foundation Server Best Practices Analyzer/en.
For this option, specify TfsBpa.Config.xml, which calls the following files:
Specifies the data XML file into which the tool should write the data that it collects. If you specify the name of a file that is not in the current directory, the tool uses the name that you specified for the output file. If you specify the name of an existing file and the analyze (-a) option, the tool performs the following tasks:
By default, the tool writes the data into TfsBpaCmd.DateTimeStamp.data.xml, in a folder that is named tfsbpaDateTimeStamp.
Specifies that the tool should load the data in File before scanning the computers. You can either use this option to collect data from additional categories in the same file or to reanalyze previous data. If you specify File as "$", the tool uses the file that is named output.Label.DateTimeStamp.xml and that has the most recent date-time stamp.
Specifies a label for the scan. If you do not specify a label, the tool uses the date and time of the scan as the label.
The tool uses the label of the scan to name the output file and folder. Also, you use the label to identify the scan in a list when you open the GUI. The value of the output file name is TfsBpaCmd.Label.DateTimeStamp.data.xml. The tool writes output files into a folder that is named tfsbpa.Label.DateTimeStamp.
-GS Name Value [...]
Specifies the computers that the tool should scan. By default, the tool scans TFSServerURL http://localserver:8080, but you can specify the options in the following table instead:
Specifies that the tool should include only those settings and objects that match the categories that are based on the parameters that you specify. All restrictions have a default value. You must specify only those categories that you want to override.
The configuration XML files define categories for settings and objects. When you restrict a scan to one category, the output of the scan includes only the information that the tool collected for the category that you specified. You can include more than one category by specifying multiple parameters.
The valid categories that you can specify might vary with different versions of the configuration XML files. Categories are identified as RestrictionType Name in the XML files. To determine the categories and levels that are valid for your version of the configuration files, run TfsBpaCmd.exe -?.
You can specify the parameters and values in the following table:
Specifies the maximum number of threads to run at the same time. By default, the value of this option is 50.
Specifies the default time (in seconds) that the tool will wait to collect data from a server that you specify. By default, the value of this option is 300.
Specifies that the tool should collect but not analyze data from the servers that you specify. By default, the tool obeys this option if you do not specify either the collect (-c) or the analyze (-a) option.
Specifies that the tool should analyze the data XML file that it generated in a previous operation. You can use this option to analyze an existing output file. You can also use this option to collect and analyze data for a new scan, either by specifying a data XML file that is not in the current directory or by not specifying a data XML file.
Specifies that the tool should not record in the output file any values that are marked NotForExport in the configuration XML files.
Specifies that the tool should run the scan by using the parameters that the GUI version stored in the registry.
Specifies that help information for the tool should appear.