PsExec returns 1073741502 error code

Hi

I have a build step that needs to execute a console app with a different user account with privileged access.

I created a .bat file that calls PsExec with the following arguments :

PsExec.exe -i -accepteula -u Username -p Password "MyConsoleApp.exe"

[15:51:09]PsExec v2.0 - Execute processes remotely
[15:51:09]Copyright (C) 2001-2013 Mark Russinovich
[15:51:09]Sysinternals - www.sysinternals.com
[15:51:09]
[15:51:09]MyConsoleApp.exe exited with error code -1073741502.
[15:51:09]Process exited with code -1073741502


I know it is not my app because I can call any executable it will return the exact same error code.

I have tried to set the Windows Account that runs the build agent service as administrator (temporarly) but it does not help.

Can anyone help ?

12 comments
Comment actions Permalink

The build agent service is running under the user account TeamCity that I created specifically for it.
As I said I tried adding it to the admin group but it still is not working. What more privileges can I give it ?

One of the post suggested to give access rights to the window station & desktop session but it was done programmatically.

The other thing I have realized is that if I have a build step that executes PsExec I may not be able to capture the console output.

0
Comment actions Permalink

What if you login as this user and run agent interactively from using bin/agent.bat?

0
Comment actions Permalink

I did try to log in with the TeamCity user and run the bat file manually. It works as expected.

I also tried to run the agent while being logged in to see if it interacts with the desktop. Same error is produced.

0
Comment actions Permalink

Please try to run agent itself, not the bat file.

0
Comment actions Permalink

I did. Please see my edited post above yours.

0
Comment actions Permalink

What would happen, if you use attached file to run the command.
Usage: java Runner <cmd> <arg0> ... <argN>

Please run it while logged in as an agent user.



Attachment(s):
Runner.class.zip
0
Comment actions Permalink

By the way, what would happen, if execute a command like this:

psexec -i -accepteula -u test -p test cmd /c "echo test > somewhere.txt"

from agent

0
Comment actions Permalink

[10:31:10]Skip checking for changes - there are no VCS roots defined

[10:31:10]Publishing internal artifacts

[10:31:10]Clearing temporary directory: D:\TeamCity\buildAgent\temp\buildTmp

[10:31:10]Checkout directory: D:\TeamCity\buildAgent\work\532794d203990edb

[10:31:10]Starting: C:\Windows\system32\cmd.exe /c PsExec.exe -i -accepteula -u Username -p password cmd /c "echo test > d:\Ticketer\TC\Tools\somewhere.txt"

[10:31:10]in directory: D:\Ticketer\TC\Tools

[10:31:11]

[10:31:11]PsExec v2.0 - Execute processes remotely

[10:31:11]Copyright (C) 2001-2013 Mark Russinovich

[10:31:11]Sysinternals - www.sysinternals.com

[10:31:11]

[10:31:12]cmd exited with error code -1073741502.

[10:31:12]Process exited with code -1073741502

[10:31:12]Publishing internal artifacts


spak wrote:

By the way, what would happen, if execute a command like this:

psexec -i -accepteula -u test -p test cmd /c "echo test > somewhere.txt"

from agent

0
Comment actions Permalink

Executing the java Runner class while logged in with the user agent account in a console prompt works as expected.

0
Comment actions Permalink

I forgot to mention but I am using TC 7.0.2 (build 21349).

0
Comment actions Permalink

Unfortunately, I'm not able to reproduce the issue, nor even try, because 7.0.2 is too old.

Anyway, let's check on what we have:
1) The psexec -i -accepteula -u test -p test cmd /c "echo test > somewhere.txt" started from java using attached try utility works.
2) The psexec that is run by build agent started interactively (via agent.bat start, not via service) under the same user fails.

This is very strange, because the code should be the same. I can only recommend you to update to the TC to have the problem fixed.

0

Please sign in to leave a comment.