# ============================================================ # Defender-Menu.ps1 - Windows 10 Home # Menu: 1 = vypnut Defender 2 = zapnut spat 3 = stav 0 = koniec # Sam si vyziada prava spravcu. # ============================================================ # --- Self-elevate (spusti sa ako spravca) --- $id = [Security.Principal.WindowsIdentity]::GetCurrent() $pr = New-Object Security.Principal.WindowsPrincipal($id) if (-not $pr.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Start-Process powershell -Verb RunAs -ArgumentList "-ExecutionPolicy Bypass -File `"$PSCommandPath`"" exit } $root = "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender" $rtp = "$root\Real-Time Protection" function Vypni { Write-Host "`n=== Vypinam Windows Defender ===" -ForegroundColor Yellow # Skus vypnut Tamper Protection + realtime cez cmdlet (nie vsade funguje) try { Set-MpPreference -DisableTamperProtection $true -ErrorAction SilentlyContinue } catch {} try { Set-MpPreference -DisableRealtimeMonitoring $true -ErrorAction SilentlyContinue } catch {} if (-not (Test-Path $root)) { New-Item -Path $root -Force | Out-Null } if (-not (Test-Path $rtp)) { New-Item -Path $rtp -Force | Out-Null } New-ItemProperty -Path $root -Name DisableAntiSpyware -Value 1 -PropertyType DWord -Force | Out-Null New-ItemProperty -Path $root -Name DisableAntiVirus -Value 1 -PropertyType DWord -Force | Out-Null New-ItemProperty -Path $rtp -Name DisableRealtimeMonitoring -Value 1 -PropertyType DWord -Force | Out-Null New-ItemProperty -Path $rtp -Name DisableBehaviorMonitoring -Value 1 -PropertyType DWord -Force | Out-Null New-ItemProperty -Path $rtp -Name DisableOnAccessProtection -Value 1 -PropertyType DWord -Force | Out-Null New-ItemProperty -Path $rtp -Name DisableScanOnRealtimeEnable -Value 1 -PropertyType DWord -Force | Out-Null Write-Host "Hotovo. RESTARTUJ pocitac, aby sa zmeny prejavili." -ForegroundColor Green Write-Host "Ak sa Defender aj tak zapne spat, rucne vypni Tamper Protection v Zabezpeceni systemu Windows." -ForegroundColor DarkYellow } function Zapni { Write-Host "`n=== Zapinam Windows Defender spat ===" -ForegroundColor Yellow try { Set-MpPreference -DisableRealtimeMonitoring $false -ErrorAction SilentlyContinue } catch {} try { Set-MpPreference -DisableTamperProtection $false -ErrorAction SilentlyContinue } catch {} if (Test-Path $rtp) { Remove-Item -Path $rtp -Recurse -Force -ErrorAction SilentlyContinue } Remove-ItemProperty -Path $root -Name DisableAntiSpyware -Force -ErrorAction SilentlyContinue Remove-ItemProperty -Path $root -Name DisableAntiVirus -Force -ErrorAction SilentlyContinue Write-Host "Hotovo. RESTARTUJ pocitac." -ForegroundColor Green } function Stav { Write-Host "`n=== Aktualny stav ===" -ForegroundColor Cyan try { $m = Get-MpComputerStatus Write-Host ("Ochrana v realnom case : " + $m.RealTimeProtectionEnabled) Write-Host ("Antivirus zapnuty : " + $m.AntivirusEnabled) Write-Host ("Tamper Protection : " + $m.IsTamperProtected) } catch { Write-Host "Stav sa neda nacitat (Defender je mozno uplne vypnuty)." -ForegroundColor DarkGray } } # --- Slucka menu --- do { Write-Host "" Write-Host "==================================================" -ForegroundColor White Write-Host " WINDOWS DEFENDER - OVLADANIE" -ForegroundColor White Write-Host "==================================================" -ForegroundColor White Write-Host " 1 = VYPNUT Defender" Write-Host " 2 = ZAPNUT Defender spat" Write-Host " 3 = Zobrazit STAV" Write-Host " 0 = Koniec" Write-Host "--------------------------------------------------" $v = Read-Host "Zadaj cislo a stlac Enter" switch ($v) { "1" { Vypni } "2" { Zapni } "3" { Stav } "0" { Write-Host "Koniec." } default { Write-Host "Neplatna volba, skus znova." -ForegroundColor Red } } if ($v -ne "0") { Write-Host ""; Read-Host "Stlac Enter pre navrat do menu" | Out-Null } } while ($v -ne "0")