The Team Foundation Server Power Tools contain a great tool called the Best Practice Analyzer. This tool helps you in automatically checking your Team Foundation Server installation and advising you on any problems that it may find.
So every time I install a new TFS environment, I use the BPA tool to validate any prerequisites and make sure the TFS environment is functioning correctly.
Running into some problems
After running BPA on a Windows Azure VM running Windows Server 2012 R2, the scan finished very quickly and showed the following:
To view more details, you can click on View a report of the Best Practices scan. This will generate a report that clearly shows something is wrong:
To view a detailed log of what’s going wrong you can click on Other Reports. This will show you a Run-Time log that contains detailed information on the error BPA is encountering:
As you can see in the log file, there is an error stating that you are running the incorrect version of PowerShell. It’s looking for version 2.0, but Windows Server is running version 4.0.
Fixing the TFSServerURLValidated error
So how you can make sure that the BPA runs on a machine with a newer version of PowerShell?
You can add a configuration file that makes sure the supported runtime is set to .NET 4.0. Switching to .NET 4.0 also switches PowerShell to version 3 or later. Since BPA is a .NET application, adding a configuration file is easy. Just create a file <NameOfExe>.exe.config. When running the application, .NET will automatically load the config file with a corresponding name and apply any configuration settings in it to your application.
By default, BPA is installed in C:\Program Files(x86)\Microsoft Team Foundation Server 2013 Power Tools\Best Practices Analyzer. In here, you’ll find TfsBpa.exe which is the executable file that runs the BPA.
Now you need to create a corresponding config file called TfsBpa.exe.config. If User Account Control kicks in and doesn’t allow you to create a file, the easiest solution is to run Notepad as an administrator and save the file directly to the correct location.
Inside your new configuration file you put the following:
And that’s it. Now BPA will run great operating systems like Windows 8 and Windows Server 2012.
Feedback? Questions? Please leave a comment!