VMware Communities
adroman
Contributor
Contributor

Unable to run VM via vmrun and SSH using script

Dear friends,
I'm unable to run VM via vmrun and SSH using script
I can run VM locally via vmrun
I can run VM via SSH if I login to SHH server manually and manually enter this command "vmrun.exe -T ws start "G:\VMs\myVM.vmx" and press Enter.

But unfortunately I can't run it using any script, for example when I try to run script [ ssh administrator@192.168.5.5 -t "startvm.bat" ] where bat-file includes previous command "vmrun.exe -T ws start "G:\VMs\myVM.vmx"
- VM starts and after several seconds stops immediately. I can see it in tray icon.
Same behavior if I use plink script, for example [plink -ssh administrator@192.168.5.5 -pw mypassword -no-antispoof -m "startvm.txt"] where txt-file includes same previous command "vmrun.exe -T ws start "G:\VMs\myVM.vmx"

Same behavior even if I use Linux SSH client.

Could you please explain how to make things work : )

0 Kudos
2 Replies
Technogeezer
Immortal
Immortal

In the Unix/Linux world, running a command with SSH doesn't run a login shell - which means that the script would not see environment variables set up the same as if you had logged in. Things that you'd expect to work wouldn't unless you crafted the batch/command file to fill in the value of environment variables (e.g. $PATH) the same as if appeared in an interactive login shell.

Perhaps something like that is happening with you trying to SSH into a Windows system. 

 

- Paul (Technogeezer)
Editor of the Unofficial Fusion Companion Guides
adroman
Contributor
Contributor

But every other commands work fine like stop and restart, I just can't start it. It starts but after several seconds - stops.

And I can do SSH session from windows machine to localhost - the behaviour is the same.

0 Kudos