title: Replace a whole line in a INI-file using Powershell
body: <p>i have a problem with replacing a whole line in a ini-file, it just seems to add my result to thesame line. </p>
  
  <p>Here is the ini-file:</p>
  
  <pre><code>    [environment]
  APP_USER=Domain\User1
  </code></pre>
  
  <p>I just wish to replace the APP_USER=Domain\User1 with for example APP_USER=Domain\User2.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>$USER = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name          
  (Get-Content D:\Test\test.ini) | ForEach-Object { $_ -replace "APP_USER=" , "APP_USER=$user" } | Set-Content D:\Test\test.ini
  </code></pre>
  
  <p>I get this result when i use the above code:</p>
  
  <pre><code>    [environment]
  APP_USER=Domain\User2Domain\User1
  </code></pre>
  
  <p>Help would be much appreciated.</p>
  
  <p>//Regard PMS</p>