PowerShell – Failed Host
I had the opportunity to break out a little powershell today to go grepping for some vi-events. I thought others might get a benefit out of this so here is a little code snippet for you to enjoy.
Our environment is made up of several clusters with multiple hosts in each. One of our hosts happened to die the other day and we wanted to know who was affected to send out an outage report. If you look in the events log, you’ll see a message along the lines of “Virtual Machine
get-cluster -name |get-vm |get-vievent | % {$_fullformattedmessage | select-string " failed"}
And that’s it. This will search through all the events and find all the entires that you were looking for. Happy hunting.