Powershell Error checking

Being a programmer by trade, I get thrown into many projects that aren’t always my forte, but I can figure them out and get them working the way that I want. I’ve been messing with powershell for a while now with VMware, but never really getting into big time scripting with it. Its mainly be something to use to accomplish some various tasks on mutliple hosts. Very little error checking in the scripts since I’m watching them was they run.

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.