PowerShell Variable Replace

Trying to get a PowerShell deployment step to work to replace a variable string within a text file.

Working correctly with the syntax:
Get-Content $TextFile
$Content -replace “Variable”, “#{DBServer}”

But this only works when the string in the text file is “Variable”.
However, the compiled text file has the string “#{DBServer}”.

Getting stuck because Octopus seems to read the contents of the text file in but replacing the variable name at which point it does not find the #{DBServer} string.
How could I search for that string and replace with the value from the variable set?

Disregard.
Got it working via a better way anyway.

Hi there,

Thanks for reaching out! If you reference the variable simply as $DBServer from the Powershell script, that should work.

Cheers,
Dalmiro