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 comments