Search code examples
windowsexepsexec

PsExec could not start app: The system cannot find the file specified


This question has been asked many times elsewhere.. but they are mostly about running things on a remote computer etc. Mine is much more straight forward.

I got an app (let's call it app.exe), which runs by a service. When it runs by the service, it is ran by the SYSTEM user.

However the app is acting weird, further when I run the same app by simply clicking on the .exe file, it runs it but with the logged in user account:

enter image description here

So I simply want to run the same app as system, that's where I found the psExec command. If I run the psExec command like so

c:\path\BOT>psExec "*** Bot.exe"

PsExec v2.2 - Execute processes remotely
Copyright (C) 2001-2016 Mark Russinovich
Sysinternals - www.sysinternals.com

it works just fine, but once i put the -s switch (ie to run as system).. it blows up:

c:\path\BOT>psExec -i -s "*** Bot.exe"

PsExec v2.2 - Execute processes remotely
Copyright (C) 2001-2016 Mark Russinovich
Sysinternals - www.sysinternals.com


PsExec could not start *** Bot.exe on SAMERDERNAI5012:
The system cannot find the file specified.

this answer states that if the cmd window is ran as non-admin, then it should work. I tried that but nothing happend.


Solution

  • I expect the bot.exe file is not in the list of directories in the PATH environment variable for the SYSTEM user.

    To system the system version of PATH open system control panel (Windows Key+Break), go to Advanced System Settings, and then Environment Variables.