@echo off
|
rem ============================================================
|
rem Double-click entry point for a fresh Windows server:
|
rem installs the TrafficAudit backend as a Windows service
|
rem (auto-start at boot) and then verifies it comes up.
|
rem
|
rem It asks for Administrator rights (UAC) and then runs
|
rem install-service.ps1 from this folder.
|
rem
|
rem If double-clicking does nothing, right-click this file and
|
rem choose "Run as administrator".
|
rem
|
rem ASCII-only on purpose: cmd.exe reads this file with the OEM
|
rem code page.
|
rem ============================================================
|
setlocal
|
cd /d "%~dp0"
|
|
if not exist "%~dp0trafficAudit.exe" (
|
echo [ERROR] trafficAudit.exe was not found next to this script.
|
echo Copy the WHOLE backend folder to the server, do not
|
echo pick single files out of it.
|
echo.
|
pause
|
exit /b 1
|
)
|
|
rem S-1-16-12288 = High Mandatory Level, i.e. this window is already elevated.
|
whoami /groups | findstr /C:"S-1-16-12288" >nul 2>&1
|
if errorlevel 1 (
|
echo Administrator rights are required. A UAC prompt will appear now.
|
powershell -NoProfile -ExecutionPolicy Bypass -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
|
if errorlevel 1 (
|
echo.
|
echo [ERROR] Automatic elevation failed.
|
echo Right-click install-service.cmd and choose
|
echo "Run as administrator" instead.
|
echo.
|
pause
|
)
|
exit /b
|
)
|
|
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0install-service.ps1" %*
|
|
echo.
|
echo ------------------------------------------------------------
|
echo Finished. Press any key to close this window.
|
pause >nul
|