PowerShell get the latest VI events

From time to time it’s nice to search the VIEvent log for something specific.   I have found using PowerShell allows you to do this very quickly.   If for example I was looking for all HA events I might use the following code:

 

Import-Module -Name VMware.VimAutomation.Core

Connect-VIServer 192.168.10.14



$ViEvents = Get-ViEvent | where {$_.FullFormattedMessage -like "*HA*"} | select *

$ViEvents.count
$ViEvents | Out-GridView

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.