From 70b329fa8862f43712029f5ee731c8d84eb30035 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Mon, 28 Jul 2025 15:54:04 +0200 Subject: [PATCH] [platform] less intrusive update of the Defender exclusion list (follow-up to RIDER-128049) GitOrigin-RevId: ed2d5455888db8424df1745de113ded791c4b0fb --- bin/win/defender-exclusions.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/win/defender-exclusions.ps1 b/bin/win/defender-exclusions.ps1 index 718ac644c32c..ecf7fd30caf5 100644 --- a/bin/win/defender-exclusions.ps1 +++ b/bin/win/defender-exclusions.ps1 @@ -1,6 +1,8 @@ <# The script adds paths, given as parameters, to the Microsoft Defender folder exclusion list, unless they are already excluded. + + See https://learn.microsoft.com/en-us/defender-endpoint/configure-extension-file-exclusions-microsoft-defender-antivirus #> #Requires -RunAsAdministrator @@ -61,14 +63,12 @@ try { foreach ($path in $args) { if (-not (Test-Excluded $path $exclusions)) { - $exclusions += $path + Add-MpPreference -ExclusionPath $path Write-Host "added: $path" } else { Write-Host "skipped: $path" } } - - Set-MpPreference -ExclusionPath $exclusions } catch { Write-Host "$($_.Exception.GetType()): $($_.Exception.Message)" Write-Host $_.ScriptStackTrace