Enable Defender ASR Rules with PowerShell

Switch on individual attack surface reduction rules — e.g. block Office apps from creating child processes.

WindowsdefendersecurityasrLow risk
Run `Add-MpPreference -AttackSurfaceReductionRules_Ids D4F940AB-401B-4EFC-AADC-AD5F3C50688A -AttackSurfaceReductionRules_Actions Enabled` to enforce that ASR rule.

01Command

Command
$ Add-MpPreference -AttackSurfaceReductionRules_Ids D4F940AB-401B-4EFC-AADC-AD5F3C50688A -AttackSurfaceReductionRules_Actions Enabled

02What it does

Each ASR rule has a fixed GUID — D4F940AB… blocks Office applications from spawning child processes, a common ransomware entry point. You enable rules one at a time or in bulk, and the Actions value also supports AuditMode to log blocks without enforcing them. Review events in the Microsoft Defender event log before flipping rules from audit to enabled.

03Risk

RiskLow risk
RequirementsAdministrator PowerShell; requires Microsoft Defender Antivirus as the active antivirus (third-party AV replaces it).
!Warning: Enabling all rules at once on a home PC can block scripts and installers you actually need; audit first.

04Undo

Undo
$ Add-MpPreference -AttackSurfaceReductionRules_Ids D4F940AB-401B-4EFC-AADC-AD5F3C50688A -AttackSurfaceReductionRules_Actions Disabled

05Sources

  • Enable attack surface reduction rules
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: PowerShell instructions use Add-MpPreference with -AttackSurfaceReductionRules_Ids and -AttackSurfaceReductionRules_Actions, listing rule GUIDs including D4F940AB-401B-4EFC-AADC-AD5F3C50688A.
  • Add-MpPreference (Defender)
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: Documents the AttackSurfaceReductionRules_Ids and AttackSurfaceReductionRules_Actions parameters.

Last verified: 2026-09-19 · Category: Security & Privacy

06Related solutions