esxi 5.0 ssh 方式管理
通过 ssh 远程登陆 esxi 服务器
1,列出所有安装好的虚拟机
#vim-cmd vmsvc/getallvms
Vmid Name File Guest OS Version Annotation
1 win2003_157 [datastore1] win2003/win2003.vmx winNetEnterpriseGuest vmx-08
11 Redhat5.7_64 [datastore1] Redhat5.7_64/Redhat5.7_64.vmx rhel5_64Guest vmx-08
2,获取虚拟机当前的状态 (vim-cmd vmsvc/power.getstate VMID)
#vim-cmd vmsvc/power.getstate 16
Retrieved runtime info
Powered off
3,启动/关闭虚拟机 (vim-cmd vmsvc/power.on VMID)
#vim-cmd vmsvc/power.on 16
关电:power.off ; 关机 power.shutdown ;重启 power.reboot
4,列出所有正在运行的虚拟机 (esxcli vm process list)
#esxcli vm process list
win2003_157
World ID: 3119722
Process ID: 0
VMX Cartel ID: 3119721
UUID: 56 4d 94 5f e1 7e d2 9e-aa c5 d4 0e 7d 6b 11 12
Display Name: win2003_157
Config File: /vmfs/volumes/50dd73fb-0f7cb0bd-3c9d-001fd0cd3f51/win2003/win2003.vmx
win2003_x64
World ID: 1426393
Process ID: 0
VMX Cartel ID: 1426392
UUID: 56 4d 6c 4d 54 32 2c 6c-d4 b0 07 81 78 8e 8e c1
Display Name: win2003_x64
Config File: /vmfs/volumes/50dd73fb-0f7cb0bd-3c9d-001fd0cd3f51/win2003_x64/win2003_x64.vmx
5,关闭某台虚拟机 (esxcli vm process kill --type=[soft,hard,force] --world-id=WorldNumber)
#esxcli vm process kill --type=soft --world-id=3565405
关闭方式 soft :正常关闭;hard :立即关闭; force : 强制关闭,直接断电
阅读(1316) | 评论(0) | 转发(0) |