Got a PSOD? Check which VMs restarted by HA!
We design highly redundant Datacenters, Clusters, Storage Systems and even Networks, but in the end we still have some unplaned outages :/
This week we had a defect Memory DIMM that caused a PSOD on one ESXi Host. HA restarted the VMs fine, but we want to know quickly which VMs restarted.
Check out a PowerCLI one liner to find the restarted VMs!
$Date=Get-Date $HAVMrestartold=1 Get-VIEvent -maxsamples 100000 -Start ($Date).AddDays(-$HAVMrestartold) -type warning | Where {$_.FullFormattedMessage -match "HA restarted"} |select CreatedTime,FullFormattedMessage |sort CreatedTime -Descending # The Output might be something like this: CreatedTime FullFormattedMessage ----------- -------------------- 16.08.2017 06:27:33 vSphere HA restarted virtual machine Test-VM-01 on host My-VMHost01 in cluster My-Cluster 16.08.2017 06:27:10 vSphere HA restarted virtual machine Test-VM-02 on host My-VMHost02 in cluster My-Cluster 16.08.2017 06:26:52 vSphere HA restarted virtual machine Test-VM-03 on host My-VMHost06 in cluster My-Cluster 16.08.2017 06:26:48 vSphere HA restarted virtual machine Test-VM-04 on host My-VMHost01 in cluster My-Cluster 16.08.2017 06:26:47 vSphere HA restarted virtual machine Test-VM-05 on host My-VMHost05 in cluster My-Cluster 16.08.2017 06:26:43 vSphere HA restarted virtual machine Test-VM-06 on host My-VMHost06 in cluster My-Cluster
One thought on “Got a PSOD? Check which VMs restarted by HA!”
Brilliant! this will be a permanent addition to my collection of one-liners.