@echo off
:: === Self-elevate ===
net session >nul 2>&1
if %errorLevel% NEQ 0 (
    echo Requesting administrative privileges...
    powershell.exe -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
    exit
)

:: === Remove the scheduled task ===
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command ^
"if (Get-ScheduledTask -TaskName 'Restart RdpGuard' -ErrorAction SilentlyContinue) { ^
    Unregister-ScheduledTask -TaskName 'Restart RdpGuard' -Confirm:$false; ^
    Write-Host 'Scheduled task ''Restart RdpGuard'' removed successfully.' ^
} else { ^
    Write-Host 'Scheduled task ''Restart RdpGuard'' does not exist.' ^
}; ^
pause"
