Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSBuild PSExec hangs without error while executing batch file

As part of as our Team Build MSBuild script, we have a deployment batch file which I need to execute on a remote server:

<Exec Command="psexec -accepteula \\servername D:\Build_Drop\DeploySites.bat "/>

I can confirm it is not permissions or firewall: if the bat command is changed to run iisreset or calc.exe for example, the command will work.

I have tried -s and >nul flags, and also wrapping the batch file in a call to cmd. I have tried with and without quotes around the bat cmd.

All the options I have tried will work fine from the cmd line on the build server, but none will work from within the build script itself.

Any ideas?

like image 890
Jon Eastwood Avatar asked Dec 04 '25 02:12

Jon Eastwood


1 Answers

Adding a -i parameter to psexec seems to have worked.

Oddly, we now get the error message:

The command "psexec -accepteula \\server -i cmd /c "D:\Build_Drop\DeploySites.bat"" exited with code 5. Please verify that you have sufficient rights to run this command.

But the command does actually work

like image 116
Jon Eastwood Avatar answered Dec 05 '25 17:12

Jon Eastwood



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!