Powershell script to query VMware ESX Servers

Hal from halr9000.com (TechProsaic) wrote a PowerShell script to query ESX hosts.

I saw an entry on NTPRO.NL about the script and because I recently attended a session about PowerShell I was triggered to give it a try and test it for myself.

The script makes use of PLINK.exe from the PuTTY project. I already had the app in my environment variables loaded. I tried to figure out how to use the object because at that time there was a credential problem at halr9000.com which resulted in the BLOG being not available. The download link to the script on NTPRO.NL was available though, so I decided to give it a try without extra documentation.

At first I had some problems with the syntax of the script (use quotation marks around the ESX hosts helped). Later on I was sure I was using the right syntax but the script still did not work, it kept returning an error about a value being null. Looking closer I found that the password for the ESX host caused the troubles. The password contained a special character "&", which was misinterpretered by Powershell  and this resulted in a wrong password being piped to PLINK.EXE.

Excluding the Host in question from the query solved the issue and the script delivered a nice output with the vm’s registered at the remaining hosts.


  1. Hi. I saw your blog posting about using Powershell to query ESX hosts. I’m just starting a blog on scripting in general but I will be focusing on ESX and Powershell scripts. One of my first posts involves listing VM snapshots using Powershell and how it differs from the Perl SDK from Vmware. I would love to hear your thoughts on the post.


Leave a comment

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

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