7

I am using VMware Workstation 6.5 on Windows Vista x64. I would like to automate some of the VM management tasks. I know that there is a COM API (http://www.vmware.com/support/developer/vix-api/) available which I could use directly.

Is there a C# wrapper for this COM API?

Thanks,

Arnie

warren
  • 32,620
  • 21
  • 85
  • 124
Arnold Zokas
  • 8,306
  • 6
  • 50
  • 76

4 Answers4

7

There's now a nice library that wraps this up: http://www.codeproject.com/KB/library/VMWareTasks.aspx

  • Thank you. Good work! Sadly, I've discovered that VMware Workstation doesn't expose certain management operations that I need (such as creation of VMs and VM teams). I won't be able to reach the level of automation that I want until I upgrade to ESX, :-( – Arnold Zokas Dec 29 '08 at 23:06
  • It is very nice indeed. And dblock is the author of said wrapper, and a very helpful person! – Retne Sep 30 '09 at 15:13
  • Fyi, VMWareTasks has moved to https://github.com/dblock/vmwaretasks/blob/master/README.md – dB. Jul 20 '12 at 12:41
5

VMWareTasks is a complete wrapper for VixCOM: http://vmwaretasks.codeplex.com

dB.
  • 4,700
  • 2
  • 46
  • 51
  • does this require some redist components to be copied ? i couldn't find any .NET wrapper library that works without installing VIX on the target box. – lysergic-acid Jul 13 '11 at 14:29
  • It requires VIX, yes. Still makes it a lot easier to use than VIX directly. – dB. Jul 29 '11 at 13:57
3

ArnieZ.

Any COM DLL can be used from .NET. Adding it as reference in visual studio will generate a DLL called

"YourDll.Interop.dll"

This is a .NET -> COM marshaling library, and will do what you need.

You can also generate this from the command line using tlbimp.exe

Of course, you'll have to keep in mind that you are invoking COM components, and remember to use the .NET Marshaling API to decrease reference counts when you are done using them, otherwise you will cause memory leaks.

I've wrapped the interop implementation in another library that implements IDisposable on its objects so that cleanup is handled automatically before, but if it is a large library, this might not be worth the effort.

FlySwat
  • 172,459
  • 74
  • 246
  • 311
1

How 'bout adding a reference to this API in your VS.Net and let VS.Net create a managed wrapper for you? I'm not aware of any "managed" API for this. Let me know if you find it :)

Vyas Bharghava
  • 6,372
  • 9
  • 39
  • 59