REM ------------------------------------------------------------------------------------------------------------------------
REM zz-01_Demo_PLMPerfService.cmd
@echo off
set action=%~1
set serviceName=01-PLMPerf_ApplicationService
set addPLMServiceHandlerExe=C:\DATEN\Entwicklung\addPLM\JF-ProgLib\ProgEntw\JFProgLibV3\10-src\addPLMServiceHandler\bin\Release\net8.0-windows\win-x64\native\addPLMServiceHandler.exe
rem set addPLMServiceHandlerExe=\\PLMServer2\media\Software\addPLMServiceHandler.exe
set toRun="%addPLMServiceHandlerExe%"
Call %action%

Pause

goto :eof

:InstallService
set toRun=%toRun% --action                             "InstallService"
rem set toRun=%toRun% --forceReinstall
set toRun=%toRun% --serviceName                        "%serviceName%"
set toRun=%toRun% --serviceDescription                 "Service for PLM Performance Analytics v4"
set toRun=%toRun% --serviceExePath                     "PLMPerformanceAnalytics.Service.exe"
set toRun=%toRun% --serviceExeParameters               "--PLMPerf_Root_DP ''\\PLMServer2\PLMPerfV4'' --Profile addPLM --ExecuteOnStart ''#ServiceHandlerExe#'' --ExecuteOnStartArguments ''--action NetworkAuth''"
set toRun=%toRun% --networkAuth                        "\\PLMServer1 CustomDomain\PLMAdmin; CustomPw"
set toRun=%toRun% --networkAuth                        "\\PLMServer2 alex; JFCRYPT:v01:18:JVlD6KZh+Jo3jYloEpEe1A=="
set toRun=%toRun% --networkMap                         "M: \\PLMServer2\media"
rem TO IMPLEMENT: set toRun=%toRun% --networkMap       "X: \\PLMServer1\share21"
set toRun=%toRun% --serviceAccount                     "CustomDom\alexb; JFCRYPT:v01:18:g8ydCmNiIP/e3fEPaGq5zw=="
rem set toRun=%toRun% --serviceAccount                 "LocalService"  has limidet acces to local computer like a local user
rem set toRun=%toRun% --serviceAccount                 "LocalSystem"   has full local admin rights but no network rights

:: Setup paths
set toRun=%toRun% --preServiceStartScriptPath          "\\PLMServer2\media\Trans\pre-service.cmd"
set toRun=%toRun% --serviceInstallOrUpdateSourceRootDP "\\PLMServer2\PLMPerfV4\01-PLMPerf.Applications\02-Service"
rem set toRun=%toRun% --serviceLocalRootDP                 "C:\ProgramData\06_JobClientService"


rem set toRun=%toRun% --autoCopyServiceFiles               "false"
set toRun=%toRun% --monitorAndRestartServiceAfterSeconds 10
set toRun=%toRun% --autoUpdateWhenIsNewerFile          "ApplicationInfo.cmd"
set toRun=%toRun% --autoUpdateWhenIsNewerFile          "PLMPerformanceAnalytics.Service.exe"

:: Request self-updates from this source path
set toRun=%toRun% --selfUpdateExePath "%addPLMServiceHandlerExe%"
call :run
goto :eof


:UninstallService
set toRun=%toRun% --action                             "UninstallService"
set toRun=%toRun% --serviceName                        "%serviceName%"
call :run
goto :eof

:run
echo %toRun%
echo.
%toRun%
pause
goto :eof

exit /b 0
