Error message with PSEXEC

Posted on 2011-03-07
Last Modified: 2012-05-11
I am trying to run an executable on a remote machine using PSEXEC.  

PSEXEC.EXE \\%SysName% -u %UserName% -p %PassWord% -i d:\path\file.exe

Get an error message:
PSEXEC.EXE \\%SysName% -u %UserName% -p %PassWord% -i d:\path\file.exe
The system cannot find the file specified.

What's wrong?
Question by:WishfulThinking
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 70

Expert Comment

ID: 35059143
If you do not see the psexec header lines, psexec itself is not found in your path. Did you check that?

Author Comment

ID: 35059185
if you mean the "PsExec v1.98 - Execute processes remotely ...", yes I see those.  Also "Contacted remote machine" and "starting service", but then the error message.
LVL 33

Expert Comment

ID: 35059233
if the path to the .exe file has spaces in it, you may need to quote it:

  "d:\path with spaces\file.exe"
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.


Author Comment

ID: 35059291
no spaces in the path .... I did try the following but it seemed to hang

psexec \\%SysName% -c file.exe -s
LVL 84

Expert Comment

ID: 35060433
Put the password in double quotes or change it to something that does NOT contain any of these characters: & < > | ^ %.
LVL 70

Accepted Solution

Qlemo earned 333 total points
ID: 35062093
I can't tell why the copy option should hang. It should either time out with an error, run, or give an error immediately.
Back to the original command: The only other reason I can imagine is that the path to the executable is not correct on the remote machine. Try to start cmd instead:
    PSEXEC.EXE \\%SysName% -u %UserName% -p %PassWord% -i cmd
If that errors out, something else is wrong, like no access to the console session.
If it displays a command prompt, try to start the program there.

Author Comment

ID: 35062277
Qlemo ... I tried the command as you suggested, took a smoke break, and it's still sitting there.  I have the line in a bat file, but tried just from the command line, still no luck.  Maybe it has to do with my credentials?  I'm an OU admin, running the command with my admin credentials, on a remote workstation in my OU .... I've tried REXEC with the same results.  I'm lost ...
LVL 70

Assisted Solution

Qlemo earned 333 total points
ID: 35062637
No idea what happens. Maybe some kind of "halfway thru" and then stuck communication. Try to remove the psexec service (e.g. with   sc delete psexesvc) before the next attempt.

Expert Comment

ID: 35079847
from the first command check that visit the remote machine and check that d:\path\file.exe exists or check \\compname\d$\path\file.exe exists if you only have remote access

could run it with cmd /c d:\path\file.exe as wel

LVL 65

Assisted Solution

RobSampson earned 167 total points
ID: 35106466
I usually run PSExec only to execute UNC paths.  This way, you can be sure that the file will be accessible, and don't need to concern yourself with whether it's a local file or not.

I also have the order of parameters slightly different. Here's what I would do, assuming that your username and password have administrative rights over all machines.

PSEXEC.EXE -accepteula -i -u domain/username -p password \\remotepca "\\server\share\file.exe"

Of course "share" can be the admin share of a drive if required, like "\\server\d$\file.exe"



Author Closing Comment

ID: 35143216
I split up the points as all of you had suggestions that worked.  Still don't know what the problem was, but after removing the service and rearranging the parameters in my command line, it worked!  Thanks!

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
AWK: Pythagoras bp script 18 49
CSV file copy field 1 to field 2 2 63
Merging two files with Perl 5 57
Set variable with 'OR' logic possible? 12 16
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question ( here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question