Data Object - VirtualMachineRuntimeInfo(vim.vm.RuntimeInfo)
The RuntimeInfo data object type provides information about the execution state and history of a virtual machine.
Properties:
bootTime* | xsd:dateTime | The timestamp when the virtual machine was most recently powered on.This property is updated when the virtual machine is powered on from the poweredOff state, and is cleared when the virtual machine is powered off. This property is not updated when a virtual machine is resumed from a suspended state. |
Sample code:
-----------------
VirtualMachine vm = (VirtualMachine) new InventoryNavigator(si.getRootFolder())
.searchManagedEntity("VirtualMachine", "<VM_Name>");
System.out.println("Recently poweredOn Date::" + vm.getRuntime().getBootTime().getTime());
Another option is to get from the Even history.