Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1131
  • Last Modified:

Error message with PSEXEC

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?
0
WishfulThinking
Asked:
WishfulThinking
3 Solutions
 
QlemoC++ DeveloperCommented:
If you do not see the psexec header lines, psexec itself is not found in your path. Did you check that?
0
 
WishfulThinkingAuthor Commented:
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.
0
 
knightEknightCommented:
if the path to the .exe file has spaces in it, you may need to quote it:

  "d:\path with spaces\file.exe"
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

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

psexec \\%SysName% -c file.exe -s
0
 
oBdACommented:
Put the password in double quotes or change it to something that does NOT contain any of these characters: & < > | ^ %.
0
 
QlemoC++ DeveloperCommented:
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.
0
 
WishfulThinkingAuthor Commented:
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 ...
0
 
QlemoC++ DeveloperCommented:
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.
0
 
sam0x01Commented:
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

0
 
RobSampsonCommented:
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"

Regards,

Rob.
0
 
WishfulThinkingAuthor Commented:
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!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now