title: Append results or text to text file by using Powershell
body: <p>I have a collection of objects with properties: ProductName and PartName. The content of collection is output to a file first:</p>
  
  <pre><code>$colProducts | sort-object ProductName | `
     Select-object ProductName PartName | `
     Format-Table -autosize ProductName, PartName | `
     Out-File myProducts.txt 
  </code></pre>
  
  <p>So far so good. However, I have trouble to append a text message to the result file like this:</p>
  
  <pre><code>Add-Content myProducts.txt "`nParts in more than one Product`n"
  </code></pre>
  
  <p>I found that the appended text is not readable at the end. One thing I notice is that the output of the first collection to a file is in Unicode, and the second one code (add-content) is in ASCII if only to a new file.</p>
  
  <p>After this, I would like to continue to add the following information the same result file:</p>
  
  <pre><code>$colProducts | Group-object PartName | sort-object PartName | `
     Where-Object {$_.Count -gt 1 } | `
     Select-object ProductName PartName | `
     Format-Table -autosize ProductName, PartName | `
     Out-File myProducts.txt
  </code></pre>
  
  <p>The above codes will overwrite to the result file. I need to append to the file. Greatly appreciate help!</p>
  
  <p><strong>Update:</strong> It is good to know -Append option. How about Add-Content? It seems adding some unreadable chars to the file after Out-File from collection.</p>