Execute Program does not expand '$Agent.PowerShell.Default$' in expected way


I switched from using the ‘Powershell’ action to using the generic ‘Execute Program’ action and was attempting to use the '$Agent.Powershell.Default$ expression
so that I don’t have to assume the path on the agent machine (that’s what its for right?).

However I discovered when running that action that the path does not expand as expected, instead I would get the following error:

The executable was not found at path C:\Users\Public\ContinuaAgentWorkspace\Ws\80$Agent.PowerShell.Default$.

It appears that its not expanding the expression at all and incorrectly inserting the agent workspace directory into the path
which is also not desirable.

What am I doing wrong?

The expression is wrong, the agent property would be $Agent.PowerShell.Default.Path$


Ooops!

Thanks Vincent!