-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenable_windows_defender.ps1
More file actions
60 lines (47 loc) · 2.41 KB
/
Copy pathenable_windows_defender.ps1
File metadata and controls
60 lines (47 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Windows Defender Enable Script
# Run this script as Administrator
# Check if running as Administrator
if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Host "This script requires Administrator privileges. Please run as Administrator." -ForegroundColor Red
Write-Host "Right-click on PowerShell and select 'Run as Administrator'" -ForegroundColor Yellow
pause
exit
}
Write-Host "=== Windows Defender Enable Script ===" -ForegroundColor Cyan
Write-Host ""
$confirm = Read-Host "Do you want to re-enable Windows Defender? (y/N)"
if ($confirm -ne "y" -and $confirm -ne "Y") {
Write-Host "Operation cancelled." -ForegroundColor Yellow
pause
exit
}
try {
Write-Host "Re-enabling Windows Defender..." -ForegroundColor Yellow
# Enable Windows Defender Real-time protection
Set-MpPreference -DisableRealtimeMonitoring $false
Write-Host "✓ Real-time monitoring enabled" -ForegroundColor Green
# Enable Windows Defender
Set-MpPreference -DisableIOAVProtection $false
Write-Host "✓ IOAV Protection enabled" -ForegroundColor Green
# Enable Windows Defender behavior monitoring
Set-MpPreference -DisableBehaviorMonitoring $false
Write-Host "✓ Behavior monitoring enabled" -ForegroundColor Green
# Enable Windows Defender block at first sight
Set-MpPreference -DisableBlockAtFirstSeen $false
Write-Host "✓ Block at first sight enabled" -ForegroundColor Green
# Enable Windows Defender cloud protection
Set-MpPreference -MAPSReporting Advanced
Write-Host "✓ Cloud protection enabled" -ForegroundColor Green
# Enable Windows Defender sample submission
Set-MpPreference -SubmitSamplesConsent SendSafeSamples
Write-Host "✓ Sample submission enabled" -ForegroundColor Green
Write-Host ""
Write-Host "Windows Defender has been re-enabled successfully!" -ForegroundColor Green
Write-Host "Your system is now protected again." -ForegroundColor Green
} catch {
Write-Host "Error occurred: $($_.Exception.Message)" -ForegroundColor Red
Write-Host "Make sure you're running as Administrator." -ForegroundColor Yellow
}
Write-Host ""
Write-Host "Press any key to exit..."
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")