get vmware esxi cpu info

~ # vmwarevim-cmd hostsvc/hosthardware | grep -A10 cpuPkg | grep description
   cpuPkg = ( [
      ( {
         dynamicType = , 
         index = 0, 
         vendor = "intel", 
         hz = 2833433579, 
         busHz = 333345127, 
         description = "Intel(R) Xeon(R) CPU           E5440  @ 2.83GHz", 
         threadId = (short) [

Here I get the info for 8 different machines to see if they all match:

for i in `seq 1 1 8`; do ssh vm30$i "vim-cmd hostsvc/hosthardware | grep -A10 cpuPkg | grep description"; done;

This works on 4.1 and 5.1 versions.


power on/off VM guests in ESXi

This is helpful for running scripts, etc. Get a list of VMs so you can find the Vmid.

# vim-cmd vmsvc/getallvms
Vmid     Name                     File                      Guest OS       Version   Annotation
16     guest1      [guest1] guest1/guest1.vmx         debian6_64Guest   vmx-09              
32     guest2      [guest2] guest2/guest2.vmx         debian6_64Guest   vmx-09              
48     guest3      [guest3] guest3/guest3.vmx         debian6_64Guest   vmx-09              
64     guest4      [guest4] guest4/guest4.vmx         debian6_64Guest   vmx-09              
80     guest5      [guest5] guest5/guest5.vmx         debian6_64Guest   vmx-09 

See if the machine is on or off:

# vim-cmd vmsvc/power.getstate 16
Retrieved runtime info
Powered on

Shut it down:

# vim-cmd vmsvc/power.shutdown 16

Then you can turn it back on:

# vim-cmd vmsvc/power.on 16

get total host memory on VMWare ESXi

It is my opinion that Graphical User Interfaces (GUIs) can make administration both easier, and more difficult. I highly prefer commandline, and many appliances and non desktop systems have a plethora of advanced options when configuring from the command line. I always void the warranty and get under the hood. All of my ESXi servers have SSH and Console enabled. If you have someone in the datacenter replacing suspect memory on an ESXi system, you don’t want to have them re-rack it and cable it up, just so you can log in through vSphere, just to see if the host sees all the memory. Just do it from commandline. Oh yeah, and free is not a recognized command on the ESXi shell.

# free
-ash: free: not found
# vim-cmd hostsvc/hosthardware | grep memorySize | sed -e 's/,//' -e 's/^ *//' 
memorySize = 34182787072

This was done on ESXi 4.1.0 Build 345043