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.
This is a notorious issue with psexec:
http://forum.sysinternals.com/psexec-always-hangs-when-run-from-java_topic5013.html
Program output lost when passed through PsExec
You can try with xCmd: http://feldkir.ch/xcmd.htm (it will not work against localhost)