4

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

JPBlanc
  • 70,406
  • 17
  • 130
  • 175
Jai
  • 319
  • 2
  • 9
  • 30

1 Answers1

-1

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

JakeRobinson
  • 298
  • 3
  • 14
  • We have libraries at work that allow us to easily inject powershell scripts into our C# code. This allows us to leverage or SysEng types who already have scripts to do things. – Christopher Painter Feb 27 '12 at 05:20
  • I would be very interested in exploring options to inject powershell scripts into C# code. Can you share some approaches/samples please? – Nikhil Mar 19 '12 at 22:54
  • @JakeRobinson: Jake is it possible to automate the execution of a PowerCLI script? For example can I execute the PowerCLI script via C# code or some other automated process/way? – Nikhil Mar 19 '12 at 22:55