@echo off
chcp 65001 >nul
title Diagnostic Hexafix

echo.
echo ================================================
echo            Diagnostic PC Hexafix
echo ================================================
echo.
echo Une fenetre va vous demander de confirmer le lancement.
echo Aucune suppression ni modification ne sera effectuee.
echo.

set "TOKEN=c7b73dc77d45513c"
set "ENDPOINT=https://hexafix.fr/api-diagnostic.php"
set "SCRIPT=%TEMP%\diagnostic-hexafix.ps1"

powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "try { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 } catch {}; Invoke-WebRequest -UseBasicParsing -Uri 'https://hexafix.fr/tools/diagnostic.ps1' -OutFile '%SCRIPT%'"

if not exist "%SCRIPT%" (
  echo.
  echo Impossible de telecharger l'outil de diagnostic.
  echo Verifiez votre connexion internet puis reessayez.
  echo.
  pause
  exit /b 1
)

powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT%" -Token "%TOKEN%" -Endpoint "%ENDPOINT%"

echo.
echo Diagnostic termine. Vous pouvez retourner sur la page Hexafix.
echo.
pause