Are there examples of C# code accessing vSphere API through PowerCLI or otherwise? For test automation, is PowerCLI script or C# code calling vSphere API the better choice? Please advise on docs and examples
Here are C# samples for the web services API: http://communities.vmware.com/community/developer/codecentral/vsphere_ws_c
And here is the programming guide for using C# with the .NET assemblies that come with PowerCLI: http://www.vmware.com/support/developer/windowstoolkit/wintk40/doc/viwin_devg.pdf
On a personal note, I prefer PowerCLI for doing my test automation. Lots of things can be accomplished with one line of PowerCLI, and you never have to open Visual Studio. ;)