Passing Dotted Octopus Variables to Powershell script

Hi!

We’re using “component.variable” notation for our variables in Octopus:
I defined test.var = “test var"
And changed my Powershell script from Nuget to use this var:
------------- Script excerpt
[CmdletBinding()]
param(
[string]$envPrefix = $envPrefix,
{…}
[string]$dotVar = ${test.var} # here
)
write-host " Test Dot Var:[$dotVar]”
------------------------- end script excerpt

But in octopus log when running this step I see output:
Test Dot Var:[]

How could I use dotted vars correctly by passing them from Octopus to Powershell script?

PS: All other vars defined in Octopus are working smoothly e.g.
If I define in Octopus vars: envPrefixFromOctopus = “something” it’ll work correctly:
------------- Script excerpt
[CmdletBinding()]
param(
[string]$envPrefix = $envPrefixFromOctopus # this one is working OK
)
write-host “EnvPrefix:[$envPrefix ]”
------------------------- end script excerpt
"EnvPrefix:[something]"

Thanks!

I tested in plain Powerhsell that it’s possible to use such variable:
PS C:\Users\aizum> ${some.var} = "dot var"
write-host ${some.var}
dot var

Hi Alex,

Thanks for reaching out. I just did a quick test run on my 3.3.21 instance and it works as expected.

You said your script is inside of a nuget package. How are you passing the parameter to your script? This should be the way to do it if you are using the latest version of Octopus: https://octopus.com/blog/script-parameters

Thanks,
Dalmiro