JetBrains IDE Microsoft Defender configuration Error
最近 Rider
開啟後跳出的 Microsoft Defender configuration
提示視窗點選 Automatically
後,會出現以下錯誤訊息:
2024-05-24 14:21:07,800 [ 69257] INFO - #c.i.d.WindowsDefenderChecker - exclusion failed:
[1, 7258ms] [C:\Users\{USERNAME}\AppData\Local\Programs\Rider\bin\launcher.exe, C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe, -ExecutionPolicy, Bypass, -NoProfile, -NonInteractive, -File, C:\Users\{USERNAME}\AppData\Local\Programs\Rider\bin\defender-exclusions.ps1, C:\Users\{USERNAME}\.nuget, C:\Users\{USERNAME}\AppData\Local\JetBrains\Rider2024.1]
output: skipped: C:\Users\{USERNAME}\.nuget
Cannot find drive. A drive with the name 'G' does not exist.
at Test-Excluded, C:\Users\{USERNAME}\AppData\Local\Programs\Rider\bin\defender-exclusions.ps1: line 23
at <ScriptBlock>, C:\Users\{USERNAME}\AppData\Local\Programs\Rider\bin\defender-exclusions.ps1: line 42
這訊息其實出現一陣子了,但因為沒啥影響所以暫時都沒去理會,今天看了有點煩,所以決定來解決這個問題。
這問題主要是因為 Windows Defender
現存的 Exclusion Path
包含了不存在的 Drive
,所以會導致 PowerShell
腳本執行失敗。
只好手動去 Windows Defender
設定中移除不存在的 Drive
的路徑,這樣就可以解決這個問題了。
路徑為: Windows Defender
-> Virus & threat protection
-> Virus & threat protection settings
-> Manage settings
-> Exclusions
-> Add or remove exclusions
。