PowerShell scripts to enable or disable key Windows Defender and platform hardening controls using registry-backed configuration.
This repository provides paired enable-* and disable-* scripts for:
- Attack Surface Reduction (ASR)
- Cloud Protection
- Exploit Protection
- LSA Protection
- Network Protection
- Real-Time Protection
- SmartScreen
- Tamper Protection
- Virtualization-Based Security (VBS)
- Windows Firewall
- Windows with PowerShell
- Run as Administrator
- Reboot may be required for some controls
- Validate in non-production first
$b = "https://raw.githubusercontent.com/OFFSECHQ/windows-security/main"
$enableOrder = @(
"attack-surface-reduction/enable-asr.ps1"
"cloud-protection/enable-cloud-protection.ps1"
"exploit-protection/enable-exploit-protection.ps1"
"lsa-protection/enable-lsa-protection.ps1"
"network-protection/enable-network-protection.ps1"
"realtime-protection/enable-realtime-protection.ps1"
"smartscreen/enable-smartscreen.ps1"
"virtualization-based-security/enable-vbs.ps1"
"windows-firewall/enable-firewall.ps1"
"tamper-protection/enable-tamper-protection.ps1"
)
$enableOrder | ForEach-Object { irm "$b/$_" | iex }$b = "https://raw.githubusercontent.com/OFFSECHQ/windows-security/main"
$disableOrder = @(
"tamper-protection/disable-tamper-protection.ps1"
"attack-surface-reduction/disable-asr.ps1"
"cloud-protection/disable-cloud-protection.ps1"
"exploit-protection/disable-exploit-protection.ps1"
"lsa-protection/disable-lsa-protection.ps1"
"network-protection/disable-network-protection.ps1"
"realtime-protection/disable-realtime-protection.ps1"
"smartscreen/disable-smartscreen.ps1"
"virtualization-based-security/disable-vbs.ps1"
"windows-firewall/disable-firewall.ps1"
)
$disableOrder | ForEach-Object { irm "$b/$_" | iex }| Module | Enable Script | Disable Script |
|---|---|---|
attack-surface-reduction |
enable-asr.ps1 |
disable-asr.ps1 |
cloud-protection |
enable-cloud-protection.ps1 |
disable-cloud-protection.ps1 |
exploit-protection |
enable-exploit-protection.ps1 |
disable-exploit-protection.ps1 |
lsa-protection |
enable-lsa-protection.ps1 |
disable-lsa-protection.ps1 |
network-protection |
enable-network-protection.ps1 |
disable-network-protection.ps1 |
realtime-protection |
enable-realtime-protection.ps1 |
disable-realtime-protection.ps1 |
smartscreen |
enable-smartscreen.ps1 |
disable-smartscreen.ps1 |
tamper-protection |
enable-tamper-protection.ps1 |
disable-tamper-protection.ps1 |
virtualization-based-security |
enable-vbs.ps1 |
disable-vbs.ps1 |
windows-firewall |
enable-firewall.ps1 |
disable-firewall.ps1 |
Base raw URL: https://raw.githubusercontent.com/OFFSECHQ/windows-security/main/
- Apply changes through change control in managed environments.
- Confirm policy conflicts (GPO, Intune, MDE baselines) before enforcement.
- Capture current state before bulk rollout.
- Use
OPERATIONS.mdfor backup, restore, and post-change verification commands.
These scripts change critical security settings. You are responsible for testing, validation, and production impact.