Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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

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

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 :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top