Link to home
Start Free TrialLog in
Avatar of ariestav
ariestav

asked on

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!
ASKER CERTIFIED SOLUTION
Avatar of serchlop
serchlop
Flag of Mexico image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Avatar of ariestav
ariestav

ASKER

@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.
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!