0

I am using psexec to start an executable in a remote system. The remote system is 64 bit while the exe pushed using psexec is 32 bit.

While running "psexec", I am providing the admin credentials of the remote system and the remote process is created using those credentials itself.

The 32 bit exe , when run on the remote system , does some operations and then spawns another executable using ShellExecute.

I am finding that on windows 7 , ShellExecute returns error code 5 (i.e. SE_ERR_ACCESSDENIED). The entire process runs fine and ShellExecute succeeds when the target machine is XP.

Any ideas or workaround for the same? I tried initializing COM , but with no benefits. Please let me know if any further details/code is required.

user1624807
  • 271
  • 1
  • 5
  • 20
  • Probably a UAC issue? – Roger Rowland May 20 '13 at 11:44
  • UAC is turned off in the machine. I tried using CreateProcess as a workaround and it returns me 1326 as error code which means "log on failure". I tried adding NetUseAdd() before the call to CreateProcess and it is returning me the same error code. Any help will be appreciated a lot. – user1624807 May 20 '13 at 12:28
  • What executable path are you passing to CreateProcess? A local path, a UNC path, a mapped drive path? – Marc Sherman May 20 '13 at 12:37
  • A unc path \\\\ExeName.exe. In CreateProcess I am providing this full path to the first argument, followed by parameters in the next. All other arguments are 0 or NULL. I am getting error 1326. – user1624807 May 20 '13 at 12:38
  • Are the admin credentials supplied via psexec valid on the server containing the file? – Harry Johnston May 22 '13 at 03:56

1 Answers1

0

I figured out the problem , actually ShellExecute was trying to execute the program which was in a share location. My guess is it was not able to access the share thus giving access denied. I used CreateProcess() instead and made sure that the share connection is made before trying to execute the process. This worked!

user1624807
  • 271
  • 1
  • 5
  • 20