How to select variables in tentacle agent powershell scripts?

In deploy.ps1, how to select variables with their name starting with “ConfigSettings”?

My intention is to create variables for value substitution in different environments.Database connection string one of common scenario, but our projects are more complicated that that.

My design is to create variable with name something like “ConfigSettings-” and its value is hashtable with xpath as key ,actual value as value.

So that in predeploy.ps1 my logic can extract FilePath from variable name and then loop through its value (hashtable), in each pair, I can use xpath to allocate element and put actual value in there.

Hope my design doesn’t confuse you.


I have variable name like this:


When I put statement in predeploy.ps1

Get-Variable | ft name

I get variable name like this ConfigSettingsArtifactsFolderf1FXGSBPSCOMMONEMAILAUTOREPLYexeconfig

Special characters (dash,dot,backwardslash) got removed.

How can I write variable name that special characters not get removed?

Problem solved.

$OctopusParameters keeps dictionary of variables, keys are original values of variable names. I need to enumerate that dictionary and pick elements starting with “ConfigSettings” and start from there.