Enumerating vSphere stats with PowerShell

I stumbled across something pretty awesome today…the fact that the Get-StatType command in PowerCLI takes a wildcard to the -stat option.

That’s not revolutionary by itself. In fact, it’s not all that useful, since the number of stats returned from the following command isn’t really excessive:

Get-StatType -entity $vmhost

There might be a few dozen lines returned, and you can do things like this to narrow it down:

Get-StatType -entity $vmhost *utilization*

to narrow it down. I was doing things like that, and then retrieving the resulting stats when I made a mistake. I did this:

Get-Stat -entity $vmhost -stat * -realtime -MaxSamples 1 -Start (Get-Date).AddMinutes(-5) | format-table -auto

In the bold part, I meant to do -stat *utilization*, but I forgot and did * instead.

Pages and pages and pages of live stats scrolled by. Seriously ridiculous amounts of live utilization numbers. I’m still working my way through them. But I just thought that if you didn’t know, you might want to check into it. I was amazed.