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

batch filepsexec

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.

Best Answer

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"
Related Question