We have a bamboo agent installed on a Windows server and is running as a service. On the service it's setup to log on using one of our domain service accounts i.e. svc_bamboo_agent. The problem I have is that when I run a simple bamboo Script task on the agent 'echo %username%' it's displaying as 'SYSTEM' instead of the expected 'svc_bamboo_agent'. Why is this? How do I change it so the script is run under the service account 'svc_bamboo_agent?
It seems like this is a known issue on Windows.
The good news is that the process should still be running as svc_bamboo_agent - just try running whoami in your script task - you should find that that returns svc_bamboo_agent, and it's really just the %USERNAME% variable that's incorrectly set by Windows.
If you depend on that variable, you can set it to the actual username as part of your script task.
Premier Support Engineer
I don't think this is an issue with Windows, it's more of a problem with the Tanuki wrapper that runs the agent, which does some black magic to load the environment, messing things up in the process, e.g., this other issue with the PATH variable.
I've wasted so much time because of this - it's not even funny. I even messed with the agent's JAR file trying to get it to run as my custom user, because I kept thinking the problem was the service running as SYSTEM... at least this post saved me from going mad.
G’day Bamboo customers, The wait is over! Bamboo Data Center edition you have been asking for is finally here! This self-managed enterprise offering of Bamboo has the resilience, reliability, and s...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events