Ces commandes sont à effectuer directement dans une console en mode SSH (exemple Putty) :
SOLUTION 1, on utilise VIM-cmd :
On the ESXi console, enter Tech Support mode and log in as root.
Get a list of all registered virtual machines, identified by their VMID, Display Name, and path to the .vmx configuration file, using this command:
vim-cmd vmsvc/getallvms
To get the current state of a virtual machine
vim-cmd vmsvc/power.getstate VMID
Power off the virtual machine using the VMID found in Step 2 and run:
vim-cmd vmsvc/power.off VMID
Note: If the virtual machine fails to power off, use the following command:
vim-cmd vmsvc/power.shutdownVMID
SOLUTION 2, on utilise esxcli sur ESXi 5 :
The esxcli command can be used locally or remotely to power off a virtual machine running on ESXi 5.0.
Open a console session where the esxcli tool is available, either in the ESXi Shell, the vSphere Management Assistant (vMA), or the location where the vSphere Command-Line Interface (vCLI) is installed.
Get a list of running virtual machines, identified by World ID, UUID, Display Name and path to the .vmx configuration file, using this command:
esxcli vm process list
Power off one of the virtual machines from the list using this command:
esxcli vm process kill –type=[soft,hard,force] –world-id=WorldNumber
Note: Three power-off methods are available. Soft is the most graceful, hard performs an immediate shutdown, and force should be used as a last resort.
Repeat step 2 and validate that the virtual machine is no longer running.