开发者

Specific examples of vSphere SDK for .NET

The vSphere SDK for .NET developers pdf has a sample that describes how to connect to Vcenter and perform operations such as power-off, reboot etc.

I need specific examples for changing VM configurati开发者_如何学运维on such as disk, memory, CPU etc as well as migration through Storage VMotion and cloning.

The vSphere PowerCLI admin guide has specific examples to the above using command line in Powershell but there are no corresponding examples in C#. Has anyone attempted these operations in C#?


The vSphere SDK for .NET comes with many samples for performing various operations.

The samples, however, need to be rebuilt using a supplied batch file(s).

Here's how it is done:

  1. Navigate to the path: VMware-vSphere-WS-SDK-4.1.0-257238\SDK\samples\DotNet
  2. Under this path, you will find various batch files, such as: Build2005.cmd and Build2008.cmd
  3. There's also a readme_dotnet.html, but it seems outdated.
  4. Open a Visual Studio command line window.
  5. Navigate to the samples\DotNet folder.
  6. If you have installed VS in a non-default location, fix up the environment variable prior to beginning:

"set the environment variable VSINSTALLDIR to the directory containing the 2 directories "Common7" and "SDK"." Please remember to use quotes around directory names that have spaces in them.

  1. Execute Build2005.cmd or Build2008.cmd (for VS2005/2008).

This will create a "cs" folder with all relevant samples (58 projects).

Hope this helps!

Lior


I've played with a number of VMWare API's and I've settled on VSphere SDK for .NET also. It's not perfect but it's the best I've found so far. As far as samples, since the PowerCLI cmdlets are just wrappers for the underlying .NET classes I tend to google for PowerCLI examples and then port that over to C#.

It seems strange that when I go to the website for code samples they simply don't have a category for this SDK. They only have samples for the SDK that's a bunch of .net class source files based on WSDL.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜