PSEXEC Fails to run locally: Error establishing communication with PsExec service

MGItkin picture MGItkin · Jul 28, 2015 · Viewed 29k times · Source

I only have this issue on a single Windows 8.1 machine in my domain when running PSEXEC locally. Before my domain password expired and was changed, running PSEXEC locally with this command worked.

\\fs\storage\QA\Mason\psexec\PSExec.exe \\support02 /accepteula -u build -p password -e -s \\fs\storage\QA\Mason\psexec\Cambria_RI.bat

Now, it produces this error:

Error establishing communication with PsExec service on SUPPORT02: The system cannot find the file specified.

EDIT1: It seems that running PSEXEC locally, with a local target (.bat) file fixes this issue. Why suddenly am I restricted to only using local files?

EDIT2: Executing the same command as above but with a different target machine machine will also work.

Answer

GrayDwarf picture GrayDwarf · Nov 24, 2015

One known solution for this exact error is to kill any rogue psexecsvc.exe process on the target machine. While this works for remote callers, I suspect it may resolve local issues as well.

If the psexecsvc.exe is hanging around after using psexec, something is likely going wrong like an application crash or simultaneous remote executions with mismatching versions.

A couple things to look at are;

  • Clean out older instances of psexecsvc.
  • Ensure you have the latest version of the pstools.
  • Ensure you are using the same versions of psexec on all your machines.
  • Use process of elimination to figure out what events are leaving the psexecsvc process running. The psexecsvc.exe should automatically exit and remove itself from %windir% where it is temporarily placed during execution.

Cleaning out rogue copies:

  • Check the %windir% directory and make sure you don't have a rogue one in there.
  • In some reported cases, the psexecsvc is being wrongly copied into the %%windir%\system32 directory. If this is the case and it continues to happen, look into your environment variables, user profiles and credentials. The path is based on "Admin$" and should be %windir%.

Workarounds if all else fails:

  • Figure out a way to kill the psexecsvc.exe process as part of cleanup.