Windows Defender (top name) is the Windows out of the box Anti-Virus.
It is pretty common to need to setup exclusions (normally on servers) so that Anti-Virus doesn’t scan everything and bring your machine to a grinding halt.
To save you typing in the Exclusions manually, you can use PowerShell scripts pretty easily.
Syntax |
Defender Path Exclusion: |
Add-MpPreference -ExclusionPath "Path" |
Get-MpPreference | Select-Object ‑Property ExclusionPath |
Defender File Type Exclusion: |
Add-MpPreference -ExclusionExtension "Extension" |
Get-MpPreference | Select-Object ‑Property ExclusionExtension |
Defender Process Exclusion: |
Add-MpPreference -ExclusionProcess "Process" |
Get-MpPreference | Select-Object ‑Property ExclusionProcess |
Example of adding exclusions for SQL 2016:
Add-MpPreference -ExclusionExtension ".mdf"
Add-MpPreference -ExclusionExtension ".ldf"
Add-MpPreference -ExclusionExtension ".ndf"
Add-MpPreference -ExclusionExtension ".bak"
Add-MpPreference -ExclusionExtension ".trn"
Add-MpPreference -ExclusionPath "E:\SQL"
Add-MpPreference -ExclusionPath "F:\SQL"
Add-MpPreference -ExclusionProcess "D:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Binn\SQLServr.exe"
Add-MpPreference -ExclusionProcess "D:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\Reporting Services\ReportServer\Bin\ReportingServicesService.exe"