查看并管理 Windows 的 Microsoft Defender 排除项
用 Get-MpPreference 列出 Defender 永不扫描的内容,用 Add-MpPreference / Remove-MpPreference 添加或移除排除项。
运行 Get-MpPreference | Select-Object -ExpandProperty ExclusionPath 即可查看当前的路径排除项,再决定增删。
01命令
命令
$ Get-MpPreference | Select-Object -ExpandProperty ExclusionPath02作用说明
排除项本质上是藏在杀毒偏好里的安全决策:被排除的内容对实时防护完全不可见,而恶意软件会故意落进已排除的路径。ExclusionProcess 与 ExclusionPath 有微妙区别——前者排除的是该进程打开的文件,无论文件存放在哪里。先审计现有列表是大家都跳过的一步,但它是弄清“为什么扫描没发现”的最快途径。
03风险
!注意: 每一条排除项都在削弱实时防护——路径要尽量窄(不要排除整个盘符根目录),并定期复查,因为排除项会静默长期存在。
04撤销
撤销
$ Remove-MpPreference -ExclusionPath "C:\Dev\build"05来源
- Get-MpPreference | Microsoft Learn依据: Microsoft documents Get-MpPreference as retrieving Defender scanning preferences, including ExclusionPath, ExclusionProcess and ExclusionExtension lists.
- Configure and validate exclusions for Microsoft Defender Antivirus | Microsoft Learn依据: Microsoft documents path, process and extension exclusions for Defender Antivirus and warns to use the narrowest scope possible when excluding items.
最后验证: 2026-09-17 · 分类: 安全与隐私