How to retrieve property within powershell script

Build Runner config:

Build runner: Command Line
Working directory: C:\temp
Command executable: powershell
Command parameters: -command "& .\TeamCityTest.ps1 <HOW TO PASS PARAMETER???>"

I am trying to pass the "" parameter into a powershell script.

What is the syntax to accomplish this?


TeamCity references are done with syntax %variable%.

The answer is to use :


I spent over 3 hours trying different combinations...

Here's my parameter field
-command "& .\TeamCityTest.ps1"

Here's my powershell script

$testName = 'TeamCity test'

$i = 0
foreach($a in $args)
 echo "### $i - $a"
 $i = $i + 1

Here's the output?

[09:28:04]: Checking for changes
[09:28:05]: Clearing temporary directory: C:\TeamCity\buildAgent\temp\buildTmp
[09:28:06]: Checkout directory: C:\TeamCity\buildAgent\work\bf0896ba254ac9a7
[09:28:06]: Parameter 'command.parameters=-command "& .\TeamCityTest.ps1"' is not fully resolved, using as is.
[09:28:06]: Parameter '' is not fully resolved, using as is.
[09:28:06]: Parameter '' is not fully resolved, using as is.
[09:28:06]: Start process: powershell -command "& .\TeamCityTest.ps1"
[09:28:06]: in: C:\temp
[09:28:07]: ### 0 -
[09:28:07]: Process exited with code 0
[09:28:07]: Build finished

Any more thoughts?


Do you have changes in the build (e.g. on the build results Changes tab)? Currently, the property is not passed if there are no changes.


I gave it a shot again (and made sure there were changes). I am still seeing the below message.

Parameter 'command.parameters=-command "& .\TeamCityTest.ps1"' is not fully resolved, using as is.

Any thoughts?


Do you find changeFiles*.txt file in build agent temp directory?

Please check property is named



Seems, there is a bug that prevents from being propery resolved. The property is passed into the scripts as system. property, but so far cannot be used in the references.
I filed this as TW-11599.

Sorry for the inconvenience.


Good to hear - thanks for the update!


Please sign in to leave a comment.