Integrating PowerShell scripts with the Visual Studio Team Services (VSTS) build system
Posted: (EET/GMT+2)
When you are using the cloud-based Visual Studio Team Services (VSTS), you can integrate PowerShell scripting into your automated build processes. While you can do a lot of things with PowerShell, starting from managing files and starting various processes, you usually need to get information back to the VSTS build process.
There's a great blog post on MSDN blogs on how to do this. Check the post for more details, but there are certain specially-named "variables" in VSTS that you can both read and set in your PowerShell scripts.
More precisely, this is done with the texts that your script outputs to the console with "Write-Host". Then, starting with two hash signs "##", you can update the status of variables within the build. For example, to set the per cent value of an action's completeness ("percent complete"), you would say:
Write-Host "##vso[task.setprogress value=$myProgress;]Sample Progress Indicator"
For full documentation on the possible variables and commands, see this GitHub page:
https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md
Hope this helps!