$ in sensitive variable is not passed into variable powershell script

I have a password stored in variables as a sensitive value, something like MyPa$wo*d. The string is passed in exactly as typed so powershell does a substitution and replaces $wo with empty string (because it is not defined).

I have tried escaping the $ but I didn’t get anywhere.

How can I use a $ in my secret password in a octopus variable?

Hi Chris,

You should be able to resolve this by surrounding your variable with single-quotes.

e.g. If your variable is named Password:

Write-Host '#{Password}'

If this doesn’t solve it, please provide a sample of your script.


Hi Michael,

Ah, I should have been quoting the variables in the script parameters option.

Eg -userName ‘#{userName}’ -password ‘#{password}’

Thanks for your help.


You’re most welcome Chris.

Happy Deployments!