May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Categories

May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

VM Operations in ESXi 4.1 ESXi 5.5 Command Line

List all the VMs running on the host:

~ # vim-cmd vmsvc/getallvms
Vmid     Name                        File                 Guest OS      Version   Annotation
612    vm_name1    [datastore] vm_name1/vm_name1.vmx     rhel6_64Guest   vmx-10
633    vm_name2    [datastore] vm_name2/vm_name2.vmx     rhel6_64Guest   vmx-10
646    vm_name3    [datastore] vm_name3/vm_name3.vmx     rhel6_64Guest   vmx-10
647    vm_name4    [datastore] vm_name4/vm_name4.vmx     rhel6_64Guest   vmx-10
664    vm_name5    [datastore] vm_name5/vm_name5.vmx     rhel6_64Guest   vmx-10


To poweroff a VM



vim-cmd vmsvc/power.off 612   #here 612 is a vim id


To poweron a VM

vim-cmd vmsvc/power.on 612   #here 612 is a vim id

There are somany commands you can use are as below:

Commands available under vmsvc/:
acquiremksticket                   get.snapshotinfo
acquireticket                          get.spaceNeededForConsolidation
connect                                   get.summary
convert.toTemplate              get.tasklist
convert.toVm                         getallvms
createdummyvm                   gethostconstraints
destroy                                    login
device.connection                  logout
device.connusbdev                message
device.disconnusbdev           power.getstate
device.diskadd                       power.hibernate
device.diskaddexisting         power.off
device.diskremove                power.on
device.getdevices                  power.reboot
device.toolsSyncSet              power.reset
device.vmiadd                       power.shutdown
device.vmiremove                power.suspend
devices.createnic                   power.suspendResume
disconnect                              queryftcompat
get.capability                         reload
get.config                                setscreenres
get.config.cpuidmask            snapshot.create
get.configoption                     snapshot.dumpoption
get.datastores                        snapshot.get
get.disabledmethods             snapshot.remove
get.environment                    snapshot.removeall
get.filelayout                          snapshot.revert
get.filelayoutex                      snapshot.setoption
get.guest                                 tools.cancelinstall
get.guestheartbeatStatus    tools.install
get.managedentitystatus     tools.upgrade
get.networks                         unregister
get.runtime                           upgrade

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>