C# code to access VMware vSphere PowerCLI

Jai picture Jai · Mar 29, 2011 · Viewed 9.2k times · Source

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

Answer

JakeRobinson picture JakeRobinson · Mar 30, 2011

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. ;)