VMware’s Code Central offers sample code for VMware vSphere SDKs and APIs. You can find and download the latest VMware Community sample code. This sample code comes in different languages including Java, Perl & C#. VMware has opened up a new section in Code Central with Visual Basic Samples, Richard Garsthagen also known as The Anykey already posted the source of his hostinfo utility.
The enclosed Visual Basic 2008 project show a sample console application that queries all hosts known to the VC server and reports their vmotion capability back.
The project uses a vc_functions module, which I use in most my applications. It simplifies a few things;
• Setup the SSL certificate handling, that any certificate will be accepted:-)
• Offers 3 basic functions; Login, FindObjects and ViewObject.
Especially finding objects with the native SDK is very complicated, as you have to create some difficult filter and objects specs. This module massively simplifies this process.
The project comes with optimized DLLs that were created from the .wdsl files that come with the vSphere SDK. Just make sure your project references to the 2 DLLs.