title: How do I add exclusions to Microsoft Security Essentials (MSE, Windows 7) through a powershell script?
body: <p>I need to be able to add antivirus exclusions to MSE on Windows 7 using a powershell (or cmd) script. If I use: </p>
  
  <pre><code>Add-MpPreference -ExclusionPath "C:\Temp"
  Add-MpPreference -ExclusionPath "C:\Users\ME\Desktop"
  </code></pre>
  
  <p>in powershell (which works for Windows 10 Windows Defender) I get this error:</p>
  
  <pre><code>The term 'Add-MpPreference' is not recognized as the name of a cmdlet, 
  function, script file, or operable program. Check
  the spelling of the name, or if a path was included, verify that the path is 
  correct and try again.
  At line:1 char:17
  + Add-MpPreference &lt;&lt;&lt;&lt;  -ExclusionPath "C:\Temp"
  + CategoryInfo          : ObjectNotFound: (Add-MpPreference:String) [], 
  CommandNotFoundException
  + FullyQualifiedErrorId : CommandNotFoundException
  </code></pre>
  
  <p>Any ideas?</p>