-
-
Save zihotki/e7fa7b3172d1c5dd4bbfa078a2d90381 to your computer and use it in GitHub Desktop.
List all TFS built-in variables for Team Foundation Build (vNext) using PowerShell script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write-Host "SYSTEM_TEAMPROJECT: $ENV:SYSTEM_TEAMPROJECT" | |
Write-Host "SYSTEM_TEAMFOUNDATIONSERVERURI: $ENV:SYSTEM_TEAMFOUNDATIONSERVERURI" | |
Write-Host "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI: $ENV:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI" | |
Write-Host "SYSTEM_COLLECTIONID: $ENV:SYSTEM_COLLECTIONID" | |
Write-Host "SYSTEM_DEFAULTWORKINGDIRECTORY: $ENV:SYSTEM_DEFAULTWORKINGDIRECTORY" | |
Write-Host "BUILD_DEFINITIONNAME: $ENV:BUILD_DEFINITIONNAME" | |
Write-Host "BUILD_DEFINITIONVERSION: $ENV:BUILD_DEFINITIONVERSION" | |
Write-Host "BUILD_BUILDNUMBER: $ENV:BUILD_BUILDNUMBER" | |
Write-Host "BUILD_BUILDURI: $ENV:BUILD_BUILDURI" | |
Write-Host "BUILD_BUILDID: $ENV:BUILD_BUILDID" | |
Write-Host "BUILD_QUEUEDBY: $ENV:BUILD_QUEUEDBY" | |
Write-Host "BUILD_QUEUEDBYID: $ENV:BUILD_QUEUEDBYID" | |
Write-Host "BUILD_REQUESTEDFOR: $ENV:BUILD_REQUESTEDFOR" | |
Write-Host "BUILD_REQUESTEDFORID: $ENV:BUILD_REQUESTEDFORID" | |
Write-Host "BUILD_SOURCEVERSION: $ENV:BUILD_SOURCEVERSION" | |
Write-Host "BUILD_SOURCEBRANCH: $ENV:BUILD_SOURCEBRANCH" | |
Write-Host "BUILD_SOURCEBRANCHNAME: $ENV:BUILD_SOURCEBRANCHNAME" | |
Write-Host "BUILD_REPOSITORY_NAME: $ENV:BUILD_REPOSITORY_NAME" | |
Write-Host "BUILD_REPOSITORY_PROVIDER: $ENV:BUILD_REPOSITORY_PROVIDER" | |
Write-Host "BUILD_REPOSITORY_CLEAN: $ENV:BUILD_REPOSITORY_CLEAN" | |
Write-Host "BUILD_REPOSITORY_URI: $ENV:BUILD_REPOSITORY_URI" | |
Write-Host "BUILD_REPOSITORY_TFVC_WORKSPACE: $ENV:BUILD_REPOSITORY_TFVC_WORKSPACE" | |
Write-Host "BUILD_REPOSITORY_TFVC_SHELVESET: $ENV:BUILD_REPOSITORY_TFVC_SHELVESET" | |
Write-Host "BUILD_REPOSITORY_GIT_SUBMODULECHECKOUT: $ENV:BUILD_REPOSITORY_GIT_SUBMODULECHECKOUT" | |
Write-Host "AGENT_NAME: $ENV:AGENT_NAME" | |
Write-Host "AGENT_ID: $ENV:AGENT_ID" | |
Write-Host "AGENT_HOMEDIRECTORY: $ENV:AGENT_HOMEDIRECTORY" | |
Write-Host "AGENT_ROOTDIRECTORY: $ENV:AGENT_ROOTDIRECTORY" | |
Write-Host "AGENT_WorkFolder: $ENV:AGENT_WorkFolder" | |
Write-Host "BUILD_REPOSITORY_LOCALPATH: $ENV:BUILD_REPOSITORY_LOCALPATH" | |
Write-Host "BUILD_SOURCESDIRECTORY: $ENV:BUILD_SOURCESDIRECTORY" | |
Write-Host "BUILD_ARTIFACTSTAGINGDIRECTORY: $ENV:BUILD_ARTIFACTSTAGINGDIRECTORY" | |
Write-Host "BUILD_STAGINGDIRECTORY: $ENV:BUILD_STAGINGDIRECTORY" | |
Write-Host "AGENT_BUILDDIRECTORY: $ENV:AGENT_BUILDDIRECTORY" | |
$nl = [System.Environment]::NewLine | |
$date = Get-Date | |
$data = ("Script executed on " + $Date.ToString("yyyy-MM-dd hh:mm:ss tt") + $nl) | |
$data = $data + $nl + "SYSTEM_TEAMPROJECT: $ENV:SYSTEM_TEAMPROJECT" | |
$data = $data + $nl + "SYSTEM_TEAMFOUNDATIONSERVERURI: $ENV:SYSTEM_TEAMFOUNDATIONSERVERURI" | |
$data = $data + $nl + "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI: $ENV:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI" | |
$data = $data + $nl + "SYSTEM_COLLECTIONID: $ENV:SYSTEM_COLLECTIONID" | |
$data = $data + $nl + "SYSTEM_DEFAULTWORKINGDIRECTORY: $ENV:SYSTEM_DEFAULTWORKINGDIRECTORY" | |
$data = $data + $nl + "BUILD_DEFINITIONNAME: $ENV:BUILD_DEFINITIONNAME" | |
$data = $data + $nl + "BUILD_DEFINITIONVERSION: $ENV:BUILD_DEFINITIONVERSION" | |
$data = $data + $nl + "BUILD_BUILDNUMBER: $ENV:BUILD_BUILDNUMBER" | |
$data = $data + $nl + "BUILD_BUILDURI: $ENV:BUILD_BUILDURI" | |
$data = $data + $nl + "BUILD_BUILDID: $ENV:BUILD_BUILDID" | |
$data = $data + $nl + "BUILD_QUEUEDBY: $ENV:BUILD_QUEUEDBY" | |
$data = $data + $nl + "BUILD_QUEUEDBYID: $ENV:BUILD_QUEUEDBYID" | |
$data = $data + $nl + "BUILD_REQUESTEDFOR: $ENV:BUILD_REQUESTEDFOR" | |
$data = $data + $nl + "BUILD_REQUESTEDFORID: $ENV:BUILD_REQUESTEDFORID" | |
$data = $data + $nl + "BUILD_SOURCEVERSION: $ENV:BUILD_SOURCEVERSION" | |
$data = $data + $nl + "BUILD_SOURCEBRANCH: $ENV:BUILD_SOURCEBRANCH" | |
$data = $data + $nl + "BUILD_SOURCEBRANCHNAME: $ENV:BUILD_SOURCEBRANCHNAME" | |
$data = $data + $nl + "BUILD_REPOSITORY_NAME: $ENV:BUILD_REPOSITORY_NAME" | |
$data = $data + $nl + "BUILD_REPOSITORY_PROVIDER: $ENV:BUILD_REPOSITORY_PROVIDER" | |
$data = $data + $nl + "BUILD_REPOSITORY_CLEAN: $ENV:BUILD_REPOSITORY_CLEAN" | |
$data = $data + $nl + "BUILD_REPOSITORY_URI: $ENV:BUILD_REPOSITORY_URI" | |
$data = $data + $nl + "BUILD_REPOSITORY_TFVC_WORKSPACE: $ENV:BUILD_REPOSITORY_TFVC_WORKSPACE" | |
$data = $data + $nl + "BUILD_REPOSITORY_TFVC_SHELVESET: $ENV:BUILD_REPOSITORY_TFVC_SHELVESET" | |
$data = $data + $nl + "BUILD_REPOSITORY_GIT_SUBMODULECHECKOUT: $ENV:BUILD_REPOSITORY_GIT_SUBMODULECHECKOUT" | |
$data = $data + $nl + "AGENT_NAME: $ENV:AGENT_NAME" | |
$data = $data + $nl + "AGENT_ID: $ENV:AGENT_ID" | |
$data = $data + $nl + "AGENT_HOMEDIRECTORY: $ENV:AGENT_HOMEDIRECTORY" | |
$data = $data + $nl + "AGENT_ROOTDIRECTORY: $ENV:AGENT_ROOTDIRECTORY" | |
$data = $data + $nl + "AGENT_WorkFolder: $ENV:AGENT_WorkFolder" | |
$data = $data + $nl + "BUILD_REPOSITORY_LOCALPATH: $ENV:BUILD_REPOSITORY_LOCALPATH" | |
$data = $data + $nl + "BUILD_SOURCESDIRECTORY: $ENV:BUILD_SOURCESDIRECTORY" | |
$data = $data + $nl + "BUILD_ARTIFACTSTAGINGDIRECTORY: $ENV:BUILD_ARTIFACTSTAGINGDIRECTORY" | |
$data = $data + $nl + "BUILD_STAGINGDIRECTORY: $ENV:BUILD_STAGINGDIRECTORY" | |
$data = $data + $nl + "AGENT_BUILDDIRECTORY: $ENV:AGENT_BUILDDIRECTORY" | |
$scriptDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent | |
$data | Out-File ($scriptDir + "\TFSBuildDebug.log") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment