VMware ESXi: A (incomplete) list of host commands Part 2

Hi,

here is part 2 of my (incomplete) list of ESXi shell commands

Managing virtual machines

First get the VMID of the vm you want to manage, you need this ID in the following commands

vim-cmd vmsvc/getallvms

Vmid  Name File Guest OS  Version  Annotation
36 .......................................

Power On
vim-cmd vmsvc/power.on 36

Power Off (Soft)

vim-cmd vmsvc/power.off 36

Power Off (Hard)

get the world ID of the virtual machine

esxcli vm process list

TestComputer

World ID: 1625788
Process ID: 0
VMX Cartel ID: 1625786
UUID: 56 4d 9e d3 8b ce ab 59-9b 22 ac 87 40 6c 48 c3
Display Name: TestComputer

And kill them

esxcli vm process kill -t [soft,hard,force] -w

esxcli vm process kill -t hard -w 1625788

Reboot a virtual machine

vim-cmd vmsvc/power.reboot 36

Suspend a vm

vim-cmd vmsvc/power.suspend

Resume a virtual machine

vim-cmd vmsvc/power.suspendResume

Reset a virtual machine

vim-cmd vmsvc/power.reset

Shutdown

vim-cmd vmsvc/power.shutdown

Snapshots

Get VMID

vim-cmd vmsvc/getallvms

Vmid  Name File Guest OS  Version  Annotation
36 .......................................

List all snapshots for a virtual machine

vim-cmd vmsvc/snapshot.get 36

Get Snapshot:
|-ROOT
--Snapshot Name : Installation Complete
--Snapshot Id : 1
--Snapshot Desciption :
--Snapshot Created On : 3/15/2013 13:20:34
--Snapshot State : powered off
--|-CHILD
----Snapshot Name : SNAP1
----Snapshot Id : 2
----Snapshot Desciption :
----Snapshot Created On : 5/14/2013 11:46:19
----Snapshot State : powered on

Create a snapshot,  including the RAM of the Machine

vim-cmd vmsvc/snapshot.create 36 "New Snap" "Snap desc" includeMemory

Delete a snapshot, where 36 is the VMID and 2 the Snapshot ID

vim-cmd vmsvc/snapshot.remove 36 2

to be continued…in Part 3

Michael

Leave a Reply