title: Script to replace line that contains text
body: <p>I found another discussion on this, where there were numerous different options available but most of them didn't seem to work for myself or the original poster. I did however find an example that is confirmed working, however I am struggling with getting it to work and hoping for help.</p>
  
  <p>I need to find a line that begins with "ServerName=" and replace this with my own line. I have used the example that was found and modified it, but I am getting errors when using it.</p>
  
  <p>PowerShell Command:</p>
  
  <pre><code>powershell -Command "(Get-Content 'KFGame\Config\PCServer-KFGame.ini') | Foreach-Object {$_ -replace '^ServerName.$', ('ServerName=Network BUF 12345 Normal')} | Set-Content  'KFGame\Config\PCServer-KFGame.ini'"
  </code></pre>
  
  <p>Error Message:</p>
  
  <blockquote>
    <p>) was unexpected at this time</p>
  </blockquote>