String replacement in a file using PowerShell
<p>I'm trying replace a few strings within another PowerShell file.</p>

<pre><code>$Source_IP = Read-Host 'Enter source IP'
$Target_IP = Read-Host 'Enter target IP'
</code></pre>

<p>By using the following line in another PowerShell script, the file shows as Modified, but the changes don't take effect.</p>

<pre><code>(Get-Content "C:\Solutions.ps1") -replace "$Target_IP = Read-Host 'Enter target IP'", "$Target_IP = '192.168.0.221'" | Set-Content "C:\Solutions.ps1"
</code></pre>

<p>Is there a reason why the changes don't take effect?</p>

<p>This is running as an Administrator, on Windows Server 2008, and PowerShell version 2 I believe.</p>