TFS Custom Extension Powershell script Parameters are not working

TFS Custom Extension Powershell script Parameters are not working inside a powershell Invoke script.

I’ve a TFS Custom Extension which I’m developing, which has a invoke powershell script and the extension runs this script and it call
powershell script inside the Invoke powershell script


Invoke-TFS.ps1 (TFS Agent executes the invoke script) works as expected

sample code:
invoke-TFS.ps1 has a if statements which executes the customScript.ps1 works fine except the TFS Variables are not working for the customScript.ps1 from TFS Agent.

if($script -eq customScript.ps1)
Write-Host "CustomScript Executed"
Write-Host "CustomScript is not Executed"

The customScript.ps1
Sample code:
param($path, $path1)

The Path and Path1 variables are passed through TFS Variables, The customScript.ps1 gets executed with all the debug statements added expect the arguments that are passed from the TFS Variables.

Please suggest to resolve the TFS Variables.

Are you getting any error ? How are you passing the TFS variables ? Can you share that too ?

I’m not getting error, my release pipeline gets succeeded.


Invoke-script.ps1 gets excuted


if($script -eq $true)





my CustomScript.ps1 has param

param($path, $path1)

I’m passing both $path and $path1 as TFS Variables, some how the TFS Variables are not getting passed.


how can i pass the argument in CustomScript.ps1?

if($script -eq $true)


.\CustomScript.ps1 -ArgumentList $path $path1


Please let me know this work or no, if no how to pass the argument.

Here is the problem.

You have parameters defined as path1 and path2, so you should use the same name of the parameters while passing the value.

.\CustomScript.ps1 -Path $path -Path $path1

and please use for formatting the code in the forums.