# 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.

This behavior has been fixed on Bamboo 6.10

## 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. Remove and reinstall agent's service.

## 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 a 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.

## 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 have 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