title: How to programmatically simulate file corruption to test ReFS Health Check and Recovery features?
body: <p>I would like to programmatically test <a href="https://docs.microsoft.com/en-us/windows-server/storage/refs/refs-overview" rel="nofollow noreferrer">Windows ReFS Health Check and Recovery</a> features.</p>
  
  <p>Note: ReFS only detects bitrot (no self-healing). To have ReFS <em>both</em> detect and auto-heal, one must also use Storage Spaces. So, I have prepared a Storage Mirror Space pool <code>S:\</code> with 2-way mirror setup.</p>
  
  <p>ReFS integrity streams have been enable with,</p>
  
  <pre><code>PS C:\&gt; Set-FileIntegrity -FileName 'S:\' -Enable $True
  </code></pre>
  
  <p>as per instructions found <a href="https://docs.microsoft.com/en-us/windows-server/storage/refs/integrity-streams" rel="nofollow noreferrer">here</a>.</p>
  
  <p>How can I programmatically simulate file corruption to test ReFS Health Check and Recovery features?</p>
  
  <p>I can't find an easy way to introduce bit-rot. All system I tried were performing only changes acceptable to ReFS as legitimate.</p>
  
  <p>A PowerShell method would be best, if possible. Perl, Python or any other good too.</p>
  
  <p>Thank you in advance.</p>