How can I get a list of all VM's on a VMWare host or vCenter host using C#?
I've searched for example code but I didn't find anything usefull.
Hi,
Have you had a look at project Onyx in the VMware labs?
enumerting VMs would be one of the simpler tasks, so I am guessing that you will have several questions like this coming up if you are coding some c# app - Onyx should ease the process.
Simple usage guide at http://www.get-virtual.info/2011/02/16/script-of-the-day-quick-and-easy-vmware-powershell-scripts/ (just change the dropdown from Powershell to C#)
Alternatively use PowerCli (where it will be as simple as Get-VM)
Or lastly, you could use Powershell in your C# code:
try :
http://www.codeproject.com/KB/cs/HowToRunPowerShell.aspx for running Powershell code directly in c#.
finally, a similar thread to this - with a solution to your question:
http://communities.vmware.com/thread/303927
Isn't it possible to do it directly with the vSphere Web Services SDK in C# without PowerCLI?
Yes, for sure - as I said before, use Project onyx to generate code snippets, then just clean it up.
Alternatively . . lookie here:
http://communities.vmware.com/thread/127126