wiki:windows:powershell:defender
Table of Contents
Defender Exclusions
Used this one to easily add Windows Defender exclusions to all of our Windows 10 PC's at work as we are not running Server 2016 which can do it via GPO.
Prep
Need to run PowerShell as Administrator and run the following command to allow custom scripts:
Set-ExecutionPolicy RemoteSigned
Answer 'y' to the prompt. Now you can run custom scripts.
Script
Create a script and name it “defender.ps1”. In an elevated PowerShell run it with:
.\defender.ps1
Here is a sanitized version of the script I built for work to keep Defender from interfering with out accounting software. You can see how you can customize it for your uses easily. There are a bunch of other commandlets for Defender you can jump off to from here.
# File Share Exclusions Add-MpPreference -ExclusionPath ('I:\AccountingSoftware','H:','\\server1\Applications') # Process Exclusions Add-MpPreference -ExclusionProcess ('AccSw.exe','AccDB.exe') # File Type Exclusions Add-MpPreference -ExclusionExtension ('.txt','.lib','.lab')
Sources
wiki/windows/powershell/defender.txt · Last modified: 2018/02/14 17:38 by matt