用 PowerShell 启用 Defender 攻击面缩减规则(ASR)
逐条开启微软 Defender 的 ASR 规则,例如阻止 Office 程序创建子进程。
运行 `Add-MpPreference -AttackSurfaceReductionRules_Ids D4F940AB-401B-4EFC-AADC-AD5F3C50688A -AttackSurfaceReductionRules_Actions Enabled`,即可启用该 ASR 规则。
01命令
命令
$ Add-MpPreference -AttackSurfaceReductionRules_Ids D4F940AB-401B-4EFC-AADC-AD5F3C50688A -AttackSurfaceReductionRules_Actions Enabled02作用说明
每条 ASR 规则都有固定 GUID——D4F940AB… 对应“阻止 Office 应用创建子进程”,这是勒索软件常见的入侵入口。规则可以逐条或批量启用,Actions 还支持 AuditMode 审计模式,只记录不拦截。建议先在审计模式观察一段时间,再切换为正式启用。
03风险
!注意: 在个人电脑上一次性启用所有规则可能误拦正常脚本和安装程序,请先审计再启用。
04撤销
撤销
$ Add-MpPreference -AttackSurfaceReductionRules_Ids D4F940AB-401B-4EFC-AADC-AD5F3C50688A -AttackSurfaceReductionRules_Actions Disabled05来源
- Enable attack surface reduction rules依据: PowerShell instructions use Add-MpPreference with -AttackSurfaceReductionRules_Ids and -AttackSurfaceReductionRules_Actions, listing rule GUIDs including D4F940AB-401B-4EFC-AADC-AD5F3C50688A.
- Add-MpPreference (Defender)依据: Documents the AttackSurfaceReductionRules_Ids and AttackSurfaceReductionRules_Actions parameters.
最后验证: 2026-09-19 · 分类: 安全与隐私