Both my ESXi and vCenter freeze up after doing a storage vMotion on the vCenter VM mentioned here: http://communities.vmware.com/message/1818399#1818399
Before I reboot my ESXi host, I need to shutdown all the running VMs in this host. Is there a command line for me to do this thru putty.exe?
What is the diff between: esxcli vms vm kill --world-id (VM world id) --type (soft/hard/force) and vm-support -X? Both appears to be power off the VMs which risk losing data. Is there a command to trigger a VM shutdown instead of power off? The VMs already have vmtools installed. So there must be a command line to trigger this.
You can try the power.shutdown option instead of power.off.
vim-cmd vmsvc/power.shutdown <vmid>
Running vim-cmd vmsvc should list the availabler commands. Look under the power.* section.
KB: Powering off a virtual machine on an ESXi host
You may also want to get VMware PowerCLI If you wish to have more granular control from a command line.
Cheers,
Robert
Hi
This I found on http://www.petri.co.il/vmware-esxi4-console-secret-commands.htm
Following that you can try vim-cmd vmsvc/power.getstate #### , where #### is the ID number of the VM to query. This will show you the actual power status of the VM in question, in the example below I am querying my "Win2003Test" server, which is suspended:
Forcing a power off of a VM is possible using vim-cmd vmsvc/power.off #### but that rather defeats the object of what we are trying to achieve (avoiding a dirty shutdown of our virtual servers in case you have forgotten!). Instead you could try vim-cmd vmsvc/power.shutdown #### which should issue a shutdown command to the VMware Tools agent on the VM, wait a few minutes and then try another power.getstate to see if it has been successful. Should that not work then you can issue a vim-cmd vmscv/power.suspend #### which will simply suspend your VM to disk so it will not be affected by a restart of the host.
I have not tried this, but though it might help
regards
Please award points if you find this helpful or correct
I found this from google too but unfortunately, vim-cmd command is not valid both from Tech Support Mode or CLI Mode on my ESXi 4.1.
vim-cmd is a valid ESXi command. I have use it in ESXi 3.5 and 4.1 u1. I am sure it works in 4.1 without update.
Try vim-cmd vmsvc/getallvms to get powered on VMs.
Use these steps:
1. Get the VM list: vim-cmd vmsvc/getallvms or vm-support -x
2. Power off the VM: vim-cmd vmsvc/power.off <vmid> or vm-support -X <World_ID> –w <dir>
There is also a method using ps and the kill command. I know VMware has a KB on this. I'll see If I can find the KB.
Robert
You can try the power.shutdown option instead of power.off.
vim-cmd vmsvc/power.shutdown <vmid>
Running vim-cmd vmsvc should list the availabler commands. Look under the power.* section.
KB: Powering off a virtual machine on an ESXi host
You may also want to get VMware PowerCLI If you wish to have more granular control from a command line.
Cheers,
Robert
Thanks, your solution is working now. I guess some of the services must have freezed up to prevent this from working. It works after I reboot the ESXi host. I have mark your reply as answer.