VMware

This Question is Possibly Answered

1 "correct" answer available (10 pts) 2 "helpful" answers available (6 pts)
2 Replies Last post: Nov 10, 2009 8:58 AM by MichaelIS  

How do I install, start, shut down, and suspend VMs via command line? posted: Sep 3, 2009 6:17 PM

Click to view Romanadvoratrelundar's profile Lurker 2 posts since
Sep 3, 2009

I've installed ESXi 4.0 on a computer, and would like to create and manage VMs via command line (via SSH). I tried installing the command line tools on Linux, but the commands don't work - they complain about some missing PERL library, and I haven't been able to get them to work.

I have gotten some command line access to work by using the console to enable ssh access, and then sshing in from another host, but despite going through teh command line documentation, it's still not clear to me how to do this. So here's what I want to do:

1) Create one or more virtual machines (say, with Linux or Windows server running on them)

2) Power on a VM

3) Suspend a VM

4) Wake a suspended VM

5) Power off a VM

6) Shut down the machine hosting ESXi.

7) Get actual CPU usage for a hosted VM.

Can someone please tell me what the correct commands are to do this? Even if you know just one, it would be helpful.

Thanks!

Click to view MichaelIS's profile Lurker 1 posts since
Sep 22, 2009
Your post is several months old so I don't know if you have resolved this problem. There are other command line tools which do not utilize perl. vmrun is a compiled binary and I do not believe it utilizes perl libs at all although I could be wrong. VMware provides a sample program with one of the SDK's, "vmrun.pl" which utilizes perl and provides similar functionality to the vmrun command.

"vmrun list" list will display running vm's on the current host.

"vmrun -T ws -gu root -gp password stop /path/to/vm.vmx", will shutdown a host

"vmrun -T ws start vm.vmx", will start a vm.

With ssh you could, "ssh usr@host vmrun -T ws start vm.vmx" to start a vm from some other host.

Note that some of the commands require vmtools installed in the guest OS. Also, the path requires escaping special characters.

Developer Social Media

Communities