Click here to Skip to main content
13,093,254 members (76,776 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


Posted 7 Feb 2013

TFS - Get List Of Software Installed On Build Agent

, 7 Feb 2013
Rate this:
Please Sign up or sign in to vote.
TFS - get list of software installed on Build agent

Originally posted on


It is common for your code projects to reference Microsoft or non Microsoft SDKs, this requires that the build agents has the SDKs installed. It is also natural that some of your projects may have a hard dependency on the version of the SDK. For example, some of your projects may only compile with Azure 1.6 SDK. The absence of the required SDK may cause your builds to fail. I tend to use the TFS Service cloud Build Service a lot, a list of software installed on the provisioned build agents will make it simple for me to analyze if I have the SDKs and their correct version installed on agents. This doesn’t really stop at TFS Service, even while building on premise a list of installed software on the build service is equally useful.


In this blog post, I’ll show you how to customize the TFS build process template to get a detailed list of software installed on the build server. This post is applicable to TFS Service, TFS 2012 and TFS 2010.

Note – If you have access to log on to the build agent, you can very well get this information by logging onto the build server and looking at the add remove programs window. For those of you who don’t have access to log on to the build server or would like a list of installed software without having to manually figure this out from the build server may find the steps below useful.


As you can see in the screen shot below, the build output includes the list of software installed on the hosted build agent.



I have a PowerShell script that returns the list of installed software on a machine…

PS> gp HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* 
|Select DisplayName, DisplayVersion, Publisher, InstallDate, HelpLink, UninstallString |ogv


I’ll have to customize the build process template to add an InvokeProcess activity which will call into my PowerShell script and print the output in the build activity.

Let’s get started ...

  • Create a copy of the build process template.


  • Add a new argument called “DeploymentScript”.


  • Set the appropriate settings in the metadata.


  • Scroll down beneath the TryCatch activity called “Try Compile, Test, and Associate Changesets and Work Items”. Add a new If activity and set the condition to "Not String.IsNullOrEmpty(DeploymentScript)" to ensure it will only run when the argument is passed.



  • Add in the Then branch of the If activity, a new Sequence activity and rename it to “Start deployment”.


  • Click on the activity and add a new variable called DeploymentScriptFilename (scoped to the “Start deployment” Sequence).


  • Add a ConvertWorkspaceItem activity on the “Start deployment” Sequence.


  • Add a InvokeProcess activity beneath the ConvertWorkspaceItem activity in the “Start deployment” Sequence. This is the important step, this is where we will specify that the PowerShell process needs to be called to execute the PowerShell script.


  • Click on the ConvertWorkspaceItem activity and change the properties. This will allow us to convert the server script path to the local path on the build workspace.
    DisplayName = Convert deployment script filename 
    Input = DeploymentScript 
    Result = DeploymentScriptFilename 
    Workspace = Workspace
  • Click on the InvokeProcess activity and change the properties
    Arguments = String.Format(" ""& '{0}' "" ", DeploymentScriptFilename) 
    DisplayName = Execute deployment script 
    FileName = "PowerShell"


  • To see results from the PowerShell command drop a WriteBuildMessage activity on the "Handle Standard Output" and pass the stdOutput variable to the Message property.



  • Check in the customized build template. You can download a working copy from here.
  • Check in the PowerShell script to get the list of installed software into the version control under a folder of your choice. I have created a folder Script and checked it in as in the screen shot below,


  • Create a new build definition using the Customized Build Template. Make sure you choose the CustomBuildProcessTemplate.xaml, set the logging verbosity to Detailed and in the Scripts section, set the server path of the PowerShell script.


  • Save the build definition and fire off the build, once the build completes, look at the build Log.


Voila! Job done… Please download a working version of the custom process template from here. Hopefully, from now on, you won’t have to request your environment management team for a list of software installed on the build server and should just be able to self service this with each build run on the server.

I hope you find this blog post… If you have any feedback, please feel free to leave a comment. Thank you for taking the time out and reading this blog post. If you enjoyed the post, remember to subscribe to Stay tuned!


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior) Avanade
United Kingdom United Kingdom
Solution Developer - C# .NET, ALM

Tarun Arora is a Microsoft Certified professional developer for Enterprise Applications. He has over 5 years of experience developing 'Energy Trading & Risk Management' solutions using Microsoft Technologies. Tarun has great passion for technology and travel (not necessarily in the same order)!

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170813.1 | Last Updated 7 Feb 2013
Article Copyright 2013 by Tarun_Arora
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid