# enable-defender.ps1 - Re-enable Windows Defender # Run as Administrator #Requires -RunAsAdministrator Write-Host "Re-enabling Windows Defender..." -ForegroundColor Yellow # Remove registry blocks Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender" -Name "DisableAntiSpyware" -ErrorAction SilentlyContinue Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender" -Name "DisableAntiVirus" -ErrorAction SilentlyContinue # Enable services $services = @("WinDefend", "SecurityHealthService", "wscsvc") foreach ($service in $services) { Set-Service -Name $service -StartupType Automatic -ErrorAction SilentlyContinue Start-Service -Name $service -ErrorAction SilentlyContinue } # Enable real-time protection Set-MpPreference -DisableRealtimeMonitoring $false -ErrorAction SilentlyContinue # Enable firewall Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True Write-Host "Windows Defender re-enabled. Restart required." -ForegroundColor Green Write-Host "Run: Restart-Computer -Force" -ForegroundColor Yellow