37 lines
1.1 KiB
Batchfile
37 lines
1.1 KiB
Batchfile
@echo off
|
|
REM GSP Windows Agent Installer
|
|
REM This script checks for Administrator privileges and launches the PowerShell installer
|
|
|
|
setlocal enabledelayedexpansion
|
|
|
|
REM Check for Administrator privileges
|
|
net session >nul 2>&1
|
|
if %errorlevel% neq 0 (
|
|
echo.
|
|
echo ERROR: This installer must be run as Administrator.
|
|
echo.
|
|
echo Please:
|
|
echo 1. Right-click this batch file
|
|
echo 2. Select "Run as Administrator"
|
|
echo 3. Click "Yes" when prompted
|
|
echo.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
REM Get the directory where this batch file is located
|
|
set "SCRIPT_DIR=%~dp0"
|
|
|
|
REM Verify the PowerShell script exists
|
|
if not exist "%SCRIPT_DIR%Install-GSP-WindowsAgent.ps1" (
|
|
echo ERROR: Install-GSP-WindowsAgent.ps1 not found in %SCRIPT_DIR%
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
REM Launch the PowerShell installer
|
|
REM Use -NoProfile to skip profile scripts, -ExecutionPolicy Bypass to allow script execution
|
|
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& '%SCRIPT_DIR%Install-GSP-WindowsAgent.ps1'" %*
|
|
|
|
REM Exit with PowerShell's exit code
|
|
exit /b %ERRORLEVEL%
|