PSEXEC The system cannot find the file specified error

14,356

Solution 1

I was having he same issue and fully qualifying the server name fixed it for me:

psexec -s -accepteula \\SERVERNAME.MYDOMAIN.COM -u DOMAIN\userName -p password cmd.exe
/c cscript \\otherServerName\c$\folder\script.vbs

Solution 2

Maybe you just copied the command incorrectly, but DOMAIN\ should precede the userName, not the password.

I am also having the same error though, with the very simple command

psexec \\SERVER cmd

I've found it seems to be a problem with PsTools 2.1; I can execute this command with PsTools 1.98 and it works fine. You might want to try using a different version of PsTools.

Share:
14,356
giacmeister
Author by

giacmeister

Updated on June 05, 2022

Comments

  • giacmeister
    giacmeister almost 2 years

    I'm trying to run a batch script on multiple servers using a vbscript that's from another server. I'm using psexec on my local machine to run this batch script.

    This is the script I'm running:(This is server 2003)

        psexec -s -accepteula \\SERVERNAME -u userName -p DOMAIN\password cmd.exe
        /c cscript \\otherServerName\c$\folder\script.vbs
    

    I'm getting this error:

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

    I'm running this script on server 2003, 2008, and 2012. When I try to run the script on a server 2008 server it gives me an "access denied" error despite the fact that I'm using administrator credentials.

    • Alex K.
      Alex K. almost 10 years
      Are you logged on to \\otherServerName ? Does it work with a local copy of the .vbs?
    • giacmeister
      giacmeister almost 10 years
      I logged on to the \\otherServerName and it works just fine. I also logged in to \\SERVERNAME and ran the script that's located on \\otherServerName and it worked fine. So I know that it can find the vbscript just fine from another server. @AlexK.
    • Matt
      Matt almost 10 years
      I would try and log onto the server using cmd and see if you can get more information from there. psexec.exe \\SERVERNAME -u userName -p DOMAIN\password cmd.exe -accepteula It is possible that the error is not refering to your script. Maybe cmd or cscript is not part of the $env:Path of that server.
    • Waman
      Waman almost 10 years
      Looks like you are trying to copy files from a file server and execute on several machines?? If you do not want to use psexec there is another simple way out.
    • giacmeister
      giacmeister almost 10 years
      @Waman You are correct, I'm using a script from the file server and executing it on many servers, what would be the other way?
    • Waman
      Waman almost 10 years
      One more question before I could tel you other way, are you triggering this from a single machine which will remotely download and execute that file on each of the servers? if so which is the base machine where you trigger from it is windows or Linux?
    • giacmeister
      giacmeister almost 10 years
      @Waman I am using my local machine to trigger a script from another single machine which will execute the file on each server. I do not have it download to each server, just execute. The base machine is windows. If that is not clear then let me know so I can reword it.
    • Waman
      Waman almost 10 years
      If your base machine is a non-windows machine you can easily trigger it in single base machine which will execute on multiple target machines (both windows n non-windows). This can be done using expect script.. I can provide you a sample in case you are planning for Linux base machine
  • bouvierr
    bouvierr almost 7 years
    I had the error with psexec 2.11, but it works fine with psexec 1.96.