# Remote agent running as a Windows Service does not pick up the PATH variable correctly

#### Still need help?

The Atlassian Community is here for you.

The behavior described in this document applies to Bamboo versions below 6.10.

If you have upgraded your Bamboo instance to a version above or including 6.10 then verify that you have also upgraded the agent wrapper on all remote agents. This process is described under "Upgrading to Bamboo 6.10" section in the Version-specific upgrade notes.

## Problem

Having a user variable PATH set for the local user account, having a system variable PATH variable set and running the Bamboo (or remote agent) Service as a local user account will cause %PATH% to contain only the user variable PATH. It does not append the user PATH to the system PATH.

Example:

User variable PATH: c:\foo
System variable PATH: c:\program files\perforce;c:\python27;c:\whatever

\$> echo %PATH%
c:\foo

Commands run on the remote or local agent that exist on the system PATH will fail with:

'<command>' is not recognized as an internal or external command

## Cause

This problem is related to a bug in Java Service Wrapper (http://sourceforge.net/p/wrapper/bugs/168/) which is used by Bamboo  BAM-16205 - Getting issue details... STATUS

## Resolution

1. Upgrade Bamboo to any version above 6.10.2.
2. After upgrading, perform a manual agent wrapper update as explained in this version-specific upgrade notes under Upgrading to Bamboo 6.10... section.

## Workaround 1

1. Manually move entries in the user variable PATH by either:
1. Moving all the entries out of the user variable PATH into the system variable PATH or
2. Moving all entries out of the user variable PATH into a new user variable LOCAL_PATH. Append %LOCAL_PATH% to the system variable PATH
1. Example: PATH=C:\Program Files\perforce;%LOCAL_PATH%
2. Delete the user variable PATH so it no longer overwrites the system variable PATH.

Alternatively, you could do the reverse and the move contents of the system variable PATH into the user variable PATH.

Make sure the user is the same user which is running the Bamboo remote agent.

## Workaround 2

Only applicable for remote agents

1. Shutdown Bamboo Remote Agent
Java Service Wrapper Community Edition only has 32 bits for Windows.
3. Extract it to an empty directory
4. Replace the following files:
1. <remote-agent-home>\bin\wrapper.exe
2. <remote-agent-home>\lib\wrapper.dll
3. <remote-agent-home>\lib\wrapper.jar
with
1. \path\to\wrapper-windows-x86-32-3.5.35\bin\wrapper.exe
2. \path\to\wrapper-windows-x86-32-3.5.35\lib\wrapper.dll
3. \path\to\wrapper-windows-x86-32-3.5.35\lib\wrapper.jar
5. If the machine only has 64-bit JDK
1. Install 32-bit JDK to an empty directory
2. Edit the file <remote-agent-home>\conf\wrapper.conf to configure the full path to 32-bit JDK:

wrapper.java.command=\full\path\to\32bit\jdk\bin\java
6. Start the Remote Agent Windows Service

## Workaround 3

Run Bamboo or the agent as a console application instead of a service via:

• <bamboo-home>/bin/start-bamboo.bat

<bamboo-agent-home>/bin/BambooAgent.bat

## Workaround 4

If Powershell version is  version 5.1 it is suggested to not setting HTTP_PROXY/HTTPS_PROXY environment variables.

Instead of this it is recommended to use System proxy settings.