Thursday, May 10, 2012

VMWARE - ESXi 4.0 - command line examples (How-to command line VMware host?)

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



~ # vim-cmd vmsvc/getallvms 
Vmid     Name                File                  Guest OS      Version   Annotation
64     server101   [local-datastore] server101/server101.vmx   rhel4_64Guest   vmx-07
80     server100   [local-datastore] server100/server100.vmx   rhel4_64Guest   vmx-07




~ # vim-cmd vmsvc/get.guest 80 
Guest information:

(vim.vm.GuestInfo) {
   dynamicType = ,
   toolsStatus = "toolsOk",
   toolsVersionStatus = "guestToolsUnmanaged",
   toolsRunningStatus = "guestToolsRunning",
   toolsVersion = "2147483647",
   guestId = "rhel4_64Guest",
   guestFamily = "linuxGuest",
   guestFullName = "Red Hat Enterprise Linux 4 (64-bit)",
   hostName = "server100",
   ipAddress = ,
   net = (vim.vm.GuestInfo.NicInfo) [
      (vim.vm.GuestInfo.NicInfo) {
         dynamicType = ,
         network = "Primary network",
         ipAddress = (string) [
            "fe80::20c:29ff:fe05:ec55"
         ],
         macAddress = "00:0c:29:05:ec:55",
         connected = true,
         deviceConfigId = 4000,
      },
      (vim.vm.GuestInfo.NicInfo) {
         dynamicType = ,
         network = "NFS Network",
         ipAddress = (string) [
            "fe80::20c:29ff:fe05:ec5f"
         ],
         macAddress = "00:0c:29:05:ec:5f",
         connected = true,
         deviceConfigId = 4001,
      }
   ],
   disk = (vim.vm.GuestInfo.DiskInfo) [
      (vim.vm.GuestInfo.DiskInfo) {
         dynamicType = ,
         diskPath = "/",
         capacity = 12387078144,
         freeSpace = 3344904192,
      },
      (vim.vm.GuestInfo.DiskInfo) {
         dynamicType = ,
         diskPath = "/boot",
         capacity = 1028120576,
         freeSpace = 1001758720,
      },
   ],
   screen = (vim.vm.GuestInfo.ScreenInfo) {
      dynamicType = ,
      width = 720,
      height = 400,
   },
   guestState = "running",
}




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



~ # vim-cmd vmsvc/get.datastores 80 
name                 vmserv7
url                  /vmfs/volumes/4a7232e5-948e00b5-f42a-18a9054626b0
capacity             145760452608
freeSpace            37782290432
accessible           1
type                 VMFS
multipleHostAccess   



~ # vim-cmd vmsvc/get.networks  80 
Networks:

(vim.Network.Summary) {
   dynamicType = ,
   network = 'vim.Network:HaNetwork-Primary network',
   name = "Primary network",
   accessible = true,
   ipPoolName = "",
}
(vim.Network.Summary) {
   dynamicType = ,
   network = 'vim.Network:HaNetwork-NFS Network',
   name = "NFS Network",
   accessible = true,
   ipPoolName = "",
}


No comments: