I have a batch script which installs a service. I am using puppet to install this service on windows using Powershell.
C:\graylog-collector\bin\graylog-collector-service.bat install GrayLogCollector
Using the above via PS would install the service as its simply launching the .bat file. This service requires JAVA_HOME
which is already set as an env system variable, but Puppet does not know that. I am trying to pass the value of JAVA_HOME
before running this batch file. I tried several different things, eg:
$JAVA_HOME = [Environment]::GetEnvironmentVariable("JAVA_HOME", "Machine"); C:\graylog-collector-0.5.0\bin\graylog-collector-service.bat install GrayLogCollector
I do not want to edit the file and do not want to declare the variable again. I am trying to use what is already set in the system. Basically, trying to get the value of JAVA_HOME
and feed it in the .bat file.