@echo off
setlocal

set "PORTAL=https://remote.alta.kommune.no"
set "RUSTDESK_EXE=%TEMP%\AltaRustDesk\rustdesk-1.4.6-x86_64.exe"
set "RUSTDESK_CFG==0nI9MWN3lDdzsyapJHMMticURHT3RVbSV2U5kler8GexdXQat2MO5UbwZlSj5kI6ISeltmIsIiI6ISawFmIsIyNxETMyozbu5SZuVXbt92auEGdsFmLlR3btVmciojI5FGblJnIsIiNxETMyozbu5SZuVXbt92auEGdsFmLlR3btVmciojI0N3boJye"

echo Alta Kommune RustDesk Quick Support
echo.
echo This will download RustDesk, apply the Alta Kommune server settings,
echo and open RustDesk so you can share your ID with support.
echo.

if not exist "%TEMP%\AltaRustDesk" mkdir "%TEMP%\AltaRustDesk"

powershell -NoProfile -ExecutionPolicy Bypass -Command ^
  "$ProgressPreference='SilentlyContinue'; Invoke-WebRequest '%PORTAL%/downloads/rustdesk-1.4.6-x86_64.exe' -OutFile '%RUSTDESK_EXE%'"

if not exist "%RUSTDESK_EXE%" (
  echo Download failed.
  pause
  exit /b 1
)

"%RUSTDESK_EXE%" --config "%RUSTDESK_CFG%"
start "" "%RUSTDESK_EXE%"

echo.
echo RustDesk is starting. Share the ID shown in RustDesk with support.
echo Keep this window open until RustDesk is visible.
pause
