Monday, August 13, 2012

The power of the esxcli command in Esxi 5

SkyHi @ Monday, August 13, 2012
The esxcli continues go grow as new versions of esxi and vsphere are introduced. This command can be
executed inside the esxi host (via ssh or the esxi shell) or remotely using the vcli.

Here are some examples of the power of this command:

1. List how many nfs mounts exist.

# esxcli storage nfs list

2. Get information about fcoe adapters and cards

# esxcli fcoe nic list
# esxcli fcoe adapter list

3. Get information about installed packages

# esxcli software vib list

4. Find out how much memory exist on your esxi server

# esxcli hardware memory get

5. Find out how many cpus exist on your esxi server

# esxcli hardware cpu list

6. Find out the name of your iscsi adapter

# esxli iscsi adapter list

7. Find out how many physical nics exist

# esxcli network nic list

8. Find out the state of your firewall

# esxcli network firewall get
# esxcli network firewall ruleset list

9. Find out information about your vmfs file systems

# esxcli storage vmfs extent list

10. Find out the version of esxi

# esxcli system version list




Then SSH to the host using Putty
The basic command to control the virtual machines is
vim-cmd vmsvc/
To manage a virtual machine you need get its ID, run:
vim-cmd vmsvc/getallvms
To get a summary of the machine run:
vim-cmd vmsvc/get.summary [ID]
To power on a VM run:
vim-cmd vmsvc/power.on [ID]
To power off a VM run
vim-cmd vmsvc/power.off [ID]
To suspend a VM run
vim-cmd vmsvc/power.suspend [ID]


REFERENCES
http://esx-guy.blogspot.ca/2012/03/power-of-esxcli-command-in-esxi-5.html
http://myitstuff.tumblr.com/post/350186035/how-to-control-esxi-virtual-machine-from-a-command-line