ESXi shell控制虚拟机开关机

To power on a virtual machine from the command line:List the inventory ID of the virtual machine with the command:

vim-cmd vmsvc/getallvms |grep <vm name>

Note: The first column of the output shows the vmid.Check the power state of the virtual machine with the command:

vim-cmd vmsvc/power.getstate <vmid>

Power-on the virtual machine with the command:

vim-cmd vmsvc/power.on <vmid>

关机就是把 power.on 改为 power.off 就可以了.参考: Powering on a virtual machine from the command line when the host cannot be managed using vSphere Client另外还有一种方法, 只能控制关机: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

Notes: 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.Alternate power off command syntax is:esxcli vm process kill -[soft,hard,force]-w WorldNumber
此条目发表在OS, vSphere分类目录,贴了, 标签。将固定链接加入收藏夹。

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注