Psexec issue when running an application on a Windows Server 2008 R2 machine from a 2003 R2 machine

2

I am trying to run an application on a Windows Server 2008 R2 machine from a Windows Server 2003 R2 machine using a batch file with the following line of code in a batch file:

psexec \\nightmachine -u DOMAIN\User -p Password -i "C:\FilePath\Application.exe" argument1 argument2

The application fails to run correctly when started using psexec, but the application will run correctly if I have logged into the nightmachine with the same user and started it from its file path via cmd. I have been able to get hold of the error returned in the application from its log and the exception returned is the following:

System.DllNotFoundException: Unable to load DLL 'rasapi32.dll': A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A)

After searching for that error code on the net, there are a lot of posts saying that this is caused by file corruption, but I cant see why that would be the case as the application will run normally when not being run from psexec. (the user is an administrator on both machines)

Can anyone please help me on this? If any more information is needed to help solve this issue then please ask and I will do my best to post it.

batch-file
psexec
asked on Super User Jun 27, 2011 by Vermin • edited Jun 27, 2011 by Gaff

2 Answers

0

I assume your UNC in the question has only one slash due is due to needing to type it this way here for formatting "\\\", but if not, fix that. I think the problem is that psexec is looking at your arguments outside of the quotes, and not knowing what to do with them. The easiest way may just be to put that command you can run on the server into a batch file and psexec that batch file, or you can try moving the second quote to after the arguments. Of course you can't have any spaces in the path then.

psexec \\nightmachine -u DOMAIN\User -p Password -i "C:\FilePath\Application.exe" argument1 argument2"
answered on Super User Jun 27, 2011 by KCotreau • edited Jun 27, 2011 by KCotreau
0

Issue solved! I found that the application running on the remote pc by psexec was losing its user details when the application was calling processes outside itself which meant any permissions that were required were being lost.

To get around this issue, i ended up setting up a scheduled task on the remote pc where the application lives to run the application using the required user's credentials. The task was set up to run once, but also set up so that it can be triggered manually. This meant that when the application was run by the task, no permissions were lost. I kicked off the task using Psexec:

psexec \\remotemachine schtasks /run /tn "Task name"

answered on Super User Jul 1, 2011 by Vermin

User contributions licensed under CC BY-SA 3.0