TFS 2013 default template run powershell script and log output TFS 2013 default template run powershell script and log output powershell powershell

TFS 2013 default template run powershell script and log output


Explicitly setting the verbosity on the default build templates is gone in VS 2013; instead every build logs diagnostic info. The raw data gets dumped to the agent's xml log in the Build Drops folder as you mentioned. To get a nice view of it though, you have to access it from the Team Web Access; you can't from Visual Studio anymore, which makes sense since viewing those diagnostic logs in Visual Studio would usually cause VS to hang.

So to view the diagnostic log in the Team Web Access, you can either:

  • If using VS 2013, you can just right-click on the build in the Build Explorer and choose Open in Browser.

or

  • From your Team Project page in the Team Web Access, select the Build tab, find the build you are interested in and double-click it, and then select the Diagnostics tab.

The following is what I have found from my experimentation on TFS 2013 Update 2:

In the build Summary and Log views (the only 2 views available from within VS), only Write-Error messages will show up. Using Write-Error in your PowerShell scripts will not mark your build as Failed, but instead will cause it to Partially Succeed.

In the Diagnostics view, Write-Host, Write-Output, Write-Warning, and Write-Error will all show up. Write-Verbose and Write-Debug do not show up though, even if you pass the -Verbose and -Debug switches as a PowerShell script argument.


If you are using TFS 2013 Default Template, you can check your Diagnostic logs in your "Team Web Access" under Builds, select the build you want to display the logs and then you will see three options:

Summary Log Diagnostics

Click in Diagnostics link and you will see a very detail logs including the powershell scripts outputs.

Moises.


I had this problem as well. I had 4 lines of writing "debug" information in 2013. You must only use Write-Host for debug information. If one of your lines is in example Write-Verbose, all the Write-Host will not show op in the diagnotics tab of your build. I tested this with TFS2013 Update 2.

You can use Write-Host and Write-Warning together.