• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5921
  • Last Modified:

Running psexec with username / password switches + program parameters causes "The handle is invalid" error.

Hi There,

I have an application that I am launching with psexec via an ssh session that I log into on the remote machine.  So, I am calling psexec on the remote machine itself.  The remote machine--a Windows 7 box--hosts MobaSSH which is a free SSH server for Windows.  The application I am launching has a GUI which must launch because I need to pass a script to the application.  The application must completely load before the script is processed.

Once logged in to the remote machine via SSH, I can launch the application, in interactive mode, with the following incantation:

psexec -d -i 2 -u myusername -p mypassword myapp -m

The application launches fine, and it is usable.  But I get the following error / output in my terminal window:

The handle is invalid.
Couldn't install PsExec service:
Starting myapp on mycomputer . . . on mycomputer. . .
myapp started on mycomputer with process ID 3900

So while I can launch the application fine, the problem is that I cannot pass the script to the application with its switch with this incantation

psexec -d -i 2 -u myusername -p mypasswrod myapp -m -r myscriptfile.jsx

I get the same error, and the script simply does not get read in by the application.  I have verified that if I am on the console session at the remote machine, and I simply type the following in a cmd shell, the script executes just fine:

myapp -m -r myscriptfile.jsx

Does anybody know what the "The handle is invalid.  Couldn't install PsExec service" error is?  Is that what is causing my script not to execute when myapp launches?

If you have any tips, suggestions, ideas as to how to solve this problem, I would be grateful.

Thank you for your time and help!
0
ariestav
Asked:
ariestav
  • 2
  • 2
1 Solution
 
serchlopCommented:
Have you tried to create a bat file with the line

myapp -m -r myscriptfile.jsx

and the call the bat in the psexec.
0
 
serchlopCommented:
Why do you uses -i 2, do you need to start the myapp in the second session?

psexec -d -i 2 -u myusername -p mypasswrod myapp -m -r myscriptfile.jsx

maybe you can try
psexec -d -i -u myusername -p mypasswrod myapp -m -r myscriptfile.jsx
to interact with desktop user.
0
 
ariestavAuthor Commented:
@serchlop I'm verifying everything works via remote desktop which runs on a second session, that's why I use -i 2.  The batch file is a good idea, and I will try it, thank you.
0
 
ariestavAuthor Commented:
The batch file worked after I used a absolute path to the script file for my application.  Thank you for the suggestion to do so!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Protect Your Employees from Wi-Fi Threats

As Wi-Fi growth and popularity continues to climb, not everyone understands the risks that come with connecting to public Wi-Fi or even offering Wi-Fi to employees, visitors and guests. Download the resource kit to make sure your safe wherever business takes you!

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