@echo off
setlocal
title ImageAnywhere Field Setup
if not exist "%~dp0Install-ImageAnywhereField.ps1" (
  echo.
  echo  Please EXTRACT the ZIP first: right-click the downloaded ZIP, choose
  echo  "Extract All...", open the extracted folder, then double-click this again.
  echo.
  pause
  exit /b 1
)
echo.
echo  ImageAnywhere field setup is starting. Keep this window open.
echo  Everything is logged to field-install-log.txt in this folder.
echo.
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%~dp0Install-ImageAnywhereField.ps1" -EnableAgentStartupTask
if %errorlevel% neq 0 goto :failed
echo.
echo  Install finished and verified.
echo  Next: sign in to ImageAnywhere, click "Pair agent", then "Refresh agent" in Connections.
echo.
pause
exit /b 0
:failed
echo.
echo  INSTALL DID NOT FINISH OR DID NOT VERIFY.
echo  Send field-install-log.txt from this folder to support.
echo.
pause
exit /b 1