xyc
昨天 df37f961e9101ce2bbc22848d7d80d8170b6ffbf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
@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