@echo off
setlocal
fltmc >nul 2>&1
if errorlevel 1 (
  powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
  exit /b
)

set "HC_SETUP_PS=%TEMP%\rustdesk-setup.ps1"
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "Invoke-WebRequest -Uri 'https://rust.h-c.support/setup/rustdesk-setup.ps1' -OutFile '%HC_SETUP_PS%'"
if errorlevel 1 goto :failed
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%HC_SETUP_PS%"
if errorlevel 1 goto :failed
del /q "%HC_SETUP_PS%" >nul 2>&1
exit /b 0

:failed
echo.
echo Die Einrichtung konnte nicht abgeschlossen werden.
echo Bitte diese Meldung dem Support mitteilen.
pause
exit /b 1
