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.
2 Responses to Powershell script to query VMware ESX Servers
Leave a Reply Cancel reply
Check the latest comments
- Mark Achtemichuk on Designing vSphere Platforms for Maximum Tier 1 Application Performance #BCA2817
- Dustin Snijders on VMworld Zoetermeer edition – KPN Consulting
- Anyone home? « Adventures in systems land on DELL announces integration of acquisitions in vStart offering
- Jij komt toch ook naar het Dutch VMUG Event 2009? | Virtual Lifestyle on It’s Official: Dutch VMUG meeting 2009 on December 11th 2009
- Matt O on Connecting ESX to SAN: PCI Device resource allocation failure
Blogroll
- Arne Fokkema
- Bjorn Bats
- Bouke Groenescheij
- David Marshall
- Duncan Epping
- Edwin Friesen
- Eric Sloof
- Frank Denneman
- Gabrie van Zanten
- Hugo Peeters
- Ivo Beerens
- Joep Piscaer
- Kenneth van Ditmarsch
- Manlio Frizzi
- Mike Laverick
- Richard Garsthagen
- Roy Mikes
- Sander Daems
- Simon Long
- The official Dutch VMUG
- Tomas ten Dam
- Vincent Vliege
- Virtual Strategy Magazine
- virtualfuture.info
- Virtualization.info
- VMGuru.nl
Archive








I can’t believe that I forgot to add the URL. The URL is http://www.bjd145.org/scripting_blog.html
Brian
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.
Thanks
Brian