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:

http://www.jonathanmedd.net/2012/03/which-vms-restarted-after-a-vsphere-ha-event.html

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:

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

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

Advertisements

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

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

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: