Running a remote batch file using psexec through Jenkins fails

automationbatch-filecontinuous integrationcontinuous-deploymentpsexec

Running a remote batch file using psexec through Jenkins fails. Running the same batch file using psexec from the slave directly works without a charm.

Let me provide some more information. Jenkins and its slave are in a separate domain than our target machine.

When I run the batch file like this:

"D:\Temp\PsTools\PsExec.exe" \\<targetmachine> -u <targetdomain\targetdomainuser> -p <pwd> -accepteula  "d:\temp\remotescript.bat" arg1 arg2

directly from the slave (Remote Desktop taking over the machine and opening a command prompt) this works perfectly.

When entering it in a windows batch build step in Jenkins there is no visible output and I just see a spinner but nothing happens anymore and the build hangs queuing any other build creating a massive backlog. Apparently I get a failure audit where my Jenkins user tries to logon to the target machine however I specified a domain user with admin rights on the target machine (a domain user for the domain of the target machine).

Does anyone have any idea why the user tries to logon with any other credentials than the ones provided and why this works running it from the Jenkins-slave directly?

Or any other way of achieving this (running a batch file on the remote machine) is more than welcome.

Best Answer

PAExec is a functional clone of PSExec and lets us see the output via Jenkins etc.

http://www.poweradmin.com/paexec/

XCmd is what we used at HP but for some reason it is not working at my current gig.

I don't know when PAExec appeared but it seems an ideal solution. Soon after discovering it (today) I nailed an intermittent problem with a very long/ involved Jenkins Deployment Pipeline.

Related Topic