Skip to content

Commit 455ab9c

Browse files
authored
Add files via upload
1 parent e2c5af2 commit 455ab9c

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

generic/DisableWindowsDefender.ps1

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#requires -RunAsAdministrator
2+
3+
<#
4+
.SYNOPSIS
5+
Disables Windows Defender Firewall and Windows Defender Antivirus.
6+
.DESCRIPTION
7+
This script disables critical Windows security features.
8+
#>
9+
10+
# Disable Windows Defender Firewall for all profiles
11+
Write-Host "Disabling Windows Defender Firewall..." -ForegroundColor Yellow
12+
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
13+
Write-Host "Windows Defender Firewall disabled for all profiles." -ForegroundColor Green
14+
15+
# Stop and disable Windows Defender services
16+
Write-Host "Disabling Windows Defender services..." -ForegroundColor Yellow
17+
$services = @(
18+
"WinDefend" # Windows Defender Antivirus Service
19+
"Sense" # Windows Defender Advanced Threat Protection
20+
"WdNisSvc" # Windows Defender Network Inspection Service
21+
"WdNisDrv" # Windows Defender Network Inspection Driver
22+
"WdBoot" # Windows Defender Boot Driver
23+
"WdFilter" # Windows Defender Filter Driver
24+
)
25+
26+
foreach ($service in $services) {
27+
try {
28+
Stop-Service -Name $service -Force -ErrorAction SilentlyContinue
29+
Set-Service -Name $service -StartupType Disabled -ErrorAction SilentlyContinue
30+
Write-Host " -> ${service}: Stopped and disabled" -ForegroundColor Green
31+
}
32+
catch {
33+
Write-Warning " -> ${service}: $($_.Exception.Message)"
34+
}
35+
}
36+
37+
# Disable Windows Defender via registry (real-time protection)
38+
Write-Host "Disabling Windows Defender real-time protection..." -ForegroundColor Yellow
39+
$regPaths = @(
40+
"HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender",
41+
"HKLM:\SOFTWARE\Microsoft\Windows Defender"
42+
)
43+
44+
foreach ($regPath in $regPaths) {
45+
if (!(Test-Path $regPath)) {
46+
New-Item -Path $regPath -Force | Out-Null
47+
}
48+
Set-ItemProperty -Path $regPath -Name "DisableAntiSpyware" -Value 1 -Type DWord -ErrorAction SilentlyContinue
49+
}
50+
51+
# Disable real-time monitoring
52+
try {
53+
Set-MpPreference -DisableRealtimeMonitoring $true -ErrorAction Stop
54+
Write-Host "Windows Defender real-time monitoring disabled." -ForegroundColor Green
55+
}
56+
catch {
57+
Write-Warning "Failed to disable real-time monitoring: $($_.Exception.Message)"
58+
}
59+
60+
# Disable tamper protection (Windows 10 1903+, Windows 11)
61+
Write-Host "Attempting to disable tamper protection..." -ForegroundColor Yellow
62+
$tpPath = "HKLM:\SOFTWARE\Microsoft\Windows Defender\Features"
63+
if (Test-Path $tpPath) {
64+
Set-ItemProperty -Path $tpPath -Name "TamperProtection" -Value 4 -Type DWord
65+
Write-Host "Tamper protection disabled." -ForegroundColor Green
66+
}
67+
68+
Write-Host "`n[!] Security features have been disabled." -ForegroundColor Red
69+
Write-Host "Remember to re-enable protections after testing." -ForegroundColor Yellow

0 commit comments

Comments
 (0)