Monitoring ESX hardware with PowerShell

Did you ever wonder where all the info under Health Status in VI Client comes from?


It turns out that your ESX server has a server built in to it that provides this information via a management standard called CIM, which is owned and promoted by the DMTF standards body. A lot of the information you can find in this CIM interface is also available through the VI API, but there is quite a bit that can only be found through CIM, most importantly, health status of the hardware hosting ESX. In this post we’ll go through some of the information that’s available and samples of getting at it.

When Microsoft released PowerShell v2 CTP3, they added some cmdlets that can access CIM. The implementation is very raw right now, for example the cmdlets don’t even have help. Also, getting this stuff working is a bit of a production. You need PowerShell v2 CTP3 and WinRM 2.0 CTP3. This latest version of WinRM only supports Windows 2008, Windows Vista and Windows Mojave, so you XP users are out of luck. You’ll also need to enable basic authentication.

Once you’ve got it set up, I’ve written a pretty easy advanced function that lets you take advantage of it.

This function makes it pretty easy to access ESX hardware information, as you’ll see below. All you need to do is connect to your ESX server, then run the function, supplying it a class name that you care about. You can find a complete list of classes in our documentation. Note that not all classes are available on all systems. As far as I know the only way to know for sure is to try it for yourself.

Here’s a sample script that puts this through its paces, and some screenshots of the results after I ran it against one of my ESX systems.

Let’s see it in action. First let’s check out all the numeric sensors that are on my system. The exact list of numeric sensors will vary from system to system, but common ones include fan speeds and temperature readings, as on my system.


It’s a little strange that my fan speeds are far below their normal minimum values, yet that doesn’t seem to be causing problems, the ambient temperature is far below the maximum value. Note that for some reason all the values here are multiplied by 100, and that the temperature are in Celsius (just like those snobby Europeans use). You can see all the possible values either by running the code or referring to this specific class in the documentation.

Next, let’s look at some actual health status, first taking on CPU.


So what the heck does HealthState 5 mean? Well I’m not sure, but one thing I am sure of is that the word uninscrutable is not in the DMTF’s collective vocabulary. To figure out what this mysterious 5 means, we again have to consult our trusty documentation. If we look at the HealthState entry we see rows for ValueMap and Values. All we have to do is correlate the value of 5 with the text in Values. Doing that we learn that HealthState 5 means “OK”.

This is true in general when you’re looking at health states: 5 always mean that the thing is OK. The value of 0 means that the state is unknown. This is not necessarily a problem, for example it may mean that the device in question is turned off. If you expect the thing to be on and useful, a value of 0 is a bad thing, otherwise it may not be worth worrying about. Any of the other values means you’ve got some sort of hardware problem that needs attention.

Now let’s look at my power supplies:


In this case I’ve got one power supply with health state 5 (OK) and one with state 0 (Unknown). Chances are my second power supply is not plugged in. (It’s in a datacenter far far away so I can’t check it.) In any event I’m not too worried about this Unknown value.

Let’s take a look at the health state of my storage. My ESX server has 3 disks, and as usual 5 is the best health state of all.


This next one shows that CIM can also be used to see data that’s also available through VI API. In this case I get the total amount of storage on this ESX system, which happens to be the same as the amount of storage in my local datastore.sample5

Finally, I take a look at some network stuff. In this case I look at Ethernet ports. Ethernet ports don’t have a health status, that’s reserved for the cards. But I can see the link status using CIM. In this case, vmnic0 and vmnic1 are plugged in while vmnic2 and vmnic3 are not.


I hope you found this useful, there’s a lot of really great information waiting to be discovered through the CIM interface.


35 comments have been added so far

  1. Hi,
    I’ll try this way to retreive health information from an ESXi server and it does not work. I always get an “access denied” error even if I use the root account.
    Any ideas ?

  2. Note: With PowerCLI 4.1 all the type names have changed so you will need to change: [VMware.VimAutomation.Client20.VMHostImpl[]]
    to: [VMware.VimAutomation.ViCore.Impl.V1.Inventory.VMHostImpl[]]
    I addition I also get access denied

  3. et-WSManInstance : Access is denied.
    t line:1 char:18
    Get-WSManInstance <<<< -Authentication basic -ConnectionURI $uri -Credential $credential -Enumerate -Port 443 -UseSS -SessionOption $option -ResourceURI "$baseurl/CIM_FAN" + CategoryInfo : InvalidOperation: (:) [Get-WSManInstance], UnauthorizedAccessException + FullyQualifiedErrorId : Exception,Microsoft.WSMan.Management.GetWSManInstanceCommand

  4. I found the host serial number here: OMC_UnitaryComputerSystem. Also you can get the BIOS version here: OMC_SMASHFirmwareIdentity

  5. I tried this on a 6.0 Update 2 host and got the error below. I noticed that the /wsman URI-stem is returning 501 Method Not Implemented. Is there an update to this script?

    Get-WSManInstance : The connection to the specified remote host was refused. Verify that the WS-Management service is
    running on the remote host and configured to listen for requests on the correct port and HTTP URL.
    At line:39 char:1
    + Get-WSManInstance -Authentication basic -ConnectionURI $uri -Credential $credent …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [Get-WSManInstance], COMException
    + FullyQualifiedErrorId : Exception,Microsoft.WSMan.Management.GetWSManInstanceCommand

  6. You will never end up feeling bored reading the recent articles posted. Quality and creativity plays the role and it’s interesting to understand the Roku.com/link activation steps explained
    Start reading and its time to learn how to link Your Roku device

  7. For activating the channel, just acquiring the activation code is enough. Paste the link code in the http://www.Hulu.com/activate and then the channel gets activated. Refer the support page or call the support team to get your issues cleared as soon as possible. The expert panel will provide the right guidance..In case of activation error call our customer care on +1-844-581-4357

  8. Channel activation is not a tough job now, and here we recommend reading the recent blog post. It’s all about Twitch channel activation using twitch.com/activate. Guidelines are simple and easy to understand. Start reading if you are interested to know more about Twitch channel, the latest shows to stream on this channel.

  9. To activate the Twitch channel using the page, twitch.com/activate, refer the recent blog post on our webpage. Activate and stay updated to know the date and schedule of your favorite Twitch channel shows

  10. If you wish to watch Fox Nation on Roku, then you need to access the Roku channel store in the first place. The basic thing is to find the channel on the store. You must use the Roku account and login to the app. Some of the shows in this app are the Five, The ingraham angle, What made America Great and Outnumbered. The programs in this channel instigate patriotism for every American. So to activate this app, surf to Foxnation.com/activate and enter the code. Call the support panel and fix the problems you face

  11. To use Roku streaming Device user have to make the Roku Account or sign in to roku.com/link by giving the alphanumeric Roku actuation code. Roku is an entertainment stick which streams various channels, for example, amazon prime, Netflix, Hulu, ESPN all channels at one place. Steps to create online Roku account is very simple which are referenced here:

  12. search to get the guidance to process the steps on the tcl roku tv screen mirroring feature, you can get the crisp explanation of the steps on this blog. If you face the issue on enabling the screen mirroring on the Roku device , you can get the best support and steps to resolve the screen mirroring issues via this blog

  13. You will never feel bored watching the MTV channel shows such as Teen Wolf, Finding Carter, Awkward, Teen Mom and lot more
    Stay entertained and If you need any help to execute mtv.com/activate, reach out to our service provider

  14. To use Roku streaming Device user have to make the Roku Account or sign in to roku.com/link by giving the alphanumeric Roku actuation code. Roku is an entertainment stick which streams various channels, for example, amazon prime, Netflix, Hulu, ESPN all channels at one place. Steps to create online Roku account is very simple which are referenced here: Roku Tv Activation

  15. Excellent information and use full post. I felt easy to understand psvue com activateroku guidelines.. It’s rare to find such Blog post that meets the Quality standards and you have done an outstanding job

  16. Tubi TV is one of the exciting channels you could ever find on the Roku channel store. As a matter of fact, its content is well received by streaming device users and if you ever wish to activate the channel, then you can hover to the tubitv.com/activate. Enter the code and activate the platform

  17. You can always enjoy watching the CBS all access Roku and the value of the plan is about $29. In addition to this, activate the Roku streaming device and access the content. The shows in this app are sublime and the presence of exclusive programs such as Star Trek: Discovery, The PGA Championship etc have been a great influence overall. You can stream the local CBS station, CBSN, ET Live and CBS Sports HQ. In case of any queries, you can contact the support team and get the issues fixed on time!

  18. If you wish to get the activation steps for the crunchy roll channel, you need to get the help of this blog. On this blog, you can get the crunchy roll channel’s features, the activation steps of the crunchy roll channel on the Roku device. To activate the Crunchyroll Roku, you can refer to this blog for the activation steps

  19. You have done an outstanding job. Your article helped me to fix the go.roku.com/low power warning on my Roku gadget. I tried executing the instructions available on your blog post. I could fix the issue quickly. I’m expecting more articles going forward 

  20. If you are interested to activate the Crunchyroll Roku channel, let us explain the channel activation steps. Begin your search to find the channel. Movies & TV is the channel store category. Its time to collect the channel activation code and provide the code visiting the channel activation portal. To get the help and support to complete Crunchyroll roku activation, please contact our team of network support executives right away

  21. Counter- strike: Global Offensive is the reason why many users throng to see the Twitch TV Libe streaming events. It is certainly a defining experience overall and if you wish to activate the app, you will have to hover to the twitch.tv/activate code

  22. I would like to thank you for the efforts you have made in writing this post. Thanks for posting Really Such Things. I should recommend your site to my friends.It is of a great advantage to take Garmin Express.

Leave a Reply

Your email address will not be published. Required fields are marked *