title: Windows Defender - Add exclusion folder programmatically
body: <p>I was checking out different keyloggers for research purposes and stumbled upon Refog:</p>
  
  <p><a href="https://www.refog.com/keylogger/" rel="noreferrer">https://www.refog.com/keylogger/</a></p>
  
  <p>This program could catch a lot of system events, but what really caught my attention was something else. The program created a hidden folder called Mpk, path C:\Windows\SysWOW64\Mpk. It was marked as an operating system files folder, because it was not visible until I unmarked <code>Hide protected operating system files (recommended)</code>. This, I guess, can be done via the attrib command like this <code>attrib +s +h "C:\Windows\SysWOW64\Mpk"</code> so nothing revolutionary.</p>
  
  <p><a href="https://i.stack.imgur.com/giDd2.png" rel="noreferrer"><img src="https://i.stack.imgur.com/giDd2.png" alt="Hide"></a></p>
  
  <p>However they also added an exclusion to Windows Defender for this folder. How can they do this programmatically? I'm running Windows 10 Pro x64.</p>
  
  <p><a href="https://i.stack.imgur.com/gK9He.png" rel="noreferrer"><img src="https://i.stack.imgur.com/gK9He.png" alt="Exclusion"></a></p>