-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstartup_agent.bat
More file actions
32 lines (26 loc) · 1.04 KB
/
startup_agent.bat
File metadata and controls
32 lines (26 loc) · 1.04 KB
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
@echo off
REM Infrastructure Agent Startup Script
REM This script is designed to run the agent at Windows startup with proper permissions
REM Log startup attempt
echo [%date% %time%] Startup script executed >> "%~dp0startup_log.txt"
REM Change to the script directory
cd /d "%~dp0"
REM Check if InfraAgent.exe exists
if not exist "InfraAgent.exe" (
echo [%date% %time%] ERROR: InfraAgent.exe not found >> "%~dp0startup_log.txt"
exit /b 1
)
REM Run the agent in hidden mode to prevent console window from showing
echo [%date% %time%] Starting InfraAgent.exe >> "%~dp0startup_log.txt"
start "" /MIN "InfraAgent.exe" --run-continuous --hidden
REM Check if the process started
timeout /t 2 /nobreak >nul
tasklist | findstr /i "InfraAgent.exe" >nul
if %errorlevel% equ 0 (
echo [%date% %time%] SUCCESS: InfraAgent.exe started >> "%~dp0startup_log.txt"
) else (
echo [%date% %time%] WARNING: InfraAgent.exe may not have started >> "%~dp0startup_log.txt"
)
REM Exit the script
echo [%date% %time%] Startup script finished >> "%~dp0startup_log.txt"
exit