You can use the following PowerCLI commandlets to get the uptime and boot time of ESXi hosts and VMs.
- Get ESXi boot time.
> Get-Cluster | Get-VMHost | Select Name, @{Name="Boot time";Expression={$_.ExtensionData.Runtime.BootTime}}
Name Boot time
---- ---------
esxi1.wxxxxx.com 2/27/2025 10:13:45 AM
esxi2.wxxxxx.com 6/18/2025 2:39:38 PM
- Get ESXi uptime.
> Get-Cluster | Get-VMHost | Select Name, @{Name="Uptime (Days)";Expression={(Get-Date) - $_.ExtensionData.Runtime.BootTime | Select-Object -ExpandProperty Days}} Name Uptime (Days) ---- ------------- esxi1.wxxxxx.com 116 esxi2.wxxxxx.com 5
- Get VM boot time.
> Get-Cluster | Get-VM | Select Name, @{Name="Boot time";Expression={$_.ExtensionData.Runtime.BootTime}} Name Boot time ---- --------- test-vineeth rhel84-vineeth VMware vCenter Server 2/25/2025 11:28:13 AM vCLS-50a1b507-5a1d-5e00-8410-7599fc72e5b5 6/18/2025 2:51:59 PM
- Get VM uptime.
> Get-Cluster | Get-VM | Select Name, @{Name="Uptime (Days)";Expression={(Get-Date) - $_.ExtensionData.Runtime.BootTime | Select-Object -ExpandProperty Days}} Name Uptime (Days) ---- ------------- test-vineeth rhel84-vineeth VMware vCenter Server 118 vCLS-50a1b507-5a1d-5e00-8410-7599fc72e5b5 5
Hope it was useful. Cheers!