title: How to replace multiple strings using PowerShell
body: <p>I want to replace 4 strings with 4 another ones and write them to file.</p>
  
  <pre><code>$file = 'C:\Defender.psd1'
  (Get-Content $file) | ForEach-Object {
      $_.replace("'MSFT_MpSignature.cdxml',", "'MSFT_MpSignature.cdxml')")
      $_.replace("'MSFT_MpWDOScan.cdxml')", "")
      $_.replace("'Remove-MpThreat',", "'Remove-MpThreat')")
      $_.replace("'Start-MpWDOScan')", "") `
  } | Out-File $file
  </code></pre>
  
  <p>But instead of this every string in the file has been duplicated 4 times. Script will be used for PowerShell 4 and 5.1.</p>