It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Execute remote windows command within Bamboo job

Deleted user Jan 28, 2012

I'm trying to deploy a package (install a few exes, copy files, and start a windows service) to a windows server. What's the best tool to do this? In general there are batch scripts on the test and prod servers that do everything I need. How do I run them remotely from a bamboo job?

When I was working on linux servers, I just used ssh and it worked great. But I'm working with windows servers now. I found PsExec.exe which actually does what I'm looking for on a command line. But if I run it inside a bamboo job, it just hangs.

I see the following:

---

29-Jan-2012 12:49:10Beginning to execute external process for build 'MyBuild - Default Job'

... running command line:

C:\Tools\PsExec.exe

\\myServer

-u

myDomain\myAdminUser

-p

password

ipconfig

... in: C:\bamboo-home\xml-data\build-dir\JOB-NAME\MySubfolder

29-Jan-2012 12:49:10

29-Jan-2012 12:44:48PsExec v1.98 - Execute processes remotely

29-Jan-2012 12:44:48Copyright (C) 2001-2010 Mark Russinovich

29-Jan-2012 12:44:48Sysinternals - www.sysinternals.com

hangs....

---

I had a similar problem with Powershell and solved it by adding <NUL to the end of the command, which worked great even in a Bamboo job.

So in short, what's the best way to execute a remote command within a Bamboo job? If PsExec, how do I get it to not hang?

Thansk!!

4 answers

1 accepted

2 votes
Answer accepted
Joe Clark Atlassian Team Jan 29, 2012

Is the bamboo agent running as a Windows service or as a user process? The first time you run psexec (or any sysinternals tool) on a computer, you'll get a EULA popup window that you need to accept. If your bamboo agent is running as a windows service, it may be hanging because it's unable to interact with the desktop to display the dialog?

You could also try fiddling with the command line parameters you pass into psexec. A quick google of "psexec hangs" should a couple of people suggesting to try using the "-d" and/or "-e" flags.

If you get stuck with psexec, you could try writing a really basic HTTP server that listens on your remote system for a command from your bamboo agent to execute the local process? Kinda hacky, though :)

Deleted user Jan 29, 2012

Joseph - that was the exact issue!!

I was logged in as User1 and was running the PsExec as -u Admin1, which worked on the command line. But the popup that I accepted was for User1. I had to login as Admin1 to dismiss that dialog. Now Bamboo finished the job successfully.

Joe Clark Atlassian Team Jul 22, 2012

Nice! I'm glad you were able to sort it out :)

You can run FreeSshD (http://www.freesshd.com/) on Windows/Windows server so it can be similar to what you are use to on linux.

Deleted user Jan 29, 2012

thanks for the suggestion! I'll keep that in mind.

You can get around the EULA problem with a switch /accepteula

Note that you have to have an updated psexec that makes use of this token.  The version I had didn't have it.  Updated to latest, and ok now.

0 votes
Deleted user Jul 20, 2012

As a side note - I was running Bamboo as a different user than myself. So yes, the EULA that shows up the first time you run PsExec was causing the hanging.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Cannot save a repository using Chrome v83 and other Chromium based browsers such as Edge

Hello Bamboo Community, I'm Jey from Bamboo Support team. If you have upgraded your Chrome browser to version 83 recently, it is observed that the save operation just spins and never completes w...

436 views 2 5
Read article

Community Events

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

Events near you