Powercli: Which VM’s were affected by HA Event 5.x

We had an HA event and needed to find out which VM’s were affected, but it has proven to be extremely difficult to identify these from the VI Client.  It appears you can do it from the Web Client as shown in this video, but I prefer the Powercli method.

Jonathon Medd has a post here:


I am interested in the update 2 which works with 5.x +

Here is the commands to get the VM’s that restarted with an HA event for last 5 days:

Get-VIEvent -maxsamples 100000 -Start ($Date).AddDays(-$HAVMrestartold) -type warning | Where {$_.FullFormattedMessage -match "restarted"} |select CreatedTime,FullFormattedMessage |sort CreatedTime -Descending

The output will list the VM’s and which host they were on. I cut off the output for security purposes.


4 Responses to Powercli: Which VM’s were affected by HA Event 5.x

  1. thanks, this just helped me today morning:)

  2. DiSalvo says:

    That number needs to be negative for it to look back on dates. at least on 6.x this would look into the future of your logs, and if you can do that well then you are a lucky admin.

  3. DiSalvo says:

    Duh, never mind I see where you made it negative in the (-$HAVMrestartold)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: