Exception connecting to VMWare Server

May 13, 2009 at 4:38 PM

Unfortunately, I haven't been able to create a simple connection to a local VMWare Server (2.0). I can see in the "what's new" document that support for VMWare Server has been added, but the following line keeps returning an exception:

virtualhost.ConnectToVMWareServer("localhost", 5);

returns a timeout exception, while


returns a VMWareException: "The system returned an error. Communication with the virtual machine may have been interrupted"

I've also tried using "https://localhost:8333/sdk", like I used to to with vmrun.exe and replacing localhost with an IP address but haven't gotten any luckier.

Any ideas? How exactly should such a connection line look like? The documentation does not have an example for the ConnectToVMWareServer() method.


Andrei Ciorba

May 15, 2009 at 1:53 PM
Edited May 15, 2009 at 1:54 PM

Interestingly I don't have a VMWare Server installed ;) But several people have been using this against VMWare Server. The parameters for a VMWare Server should be left blank as per VMWare doc, not a DNS name. The second attempt of http://... is a VMWare VI (ESX) SDK path, so that's definitely not the right thing. Leave the default timeout (60 or something). If you still get a timeout, then I suggest you write a simple connect without the library and post the code to VixCOM community.

This thread, http://communities.vmware.com/thread/85509, has raw code to connect to a local VMWare Server.

May 16, 2009 at 5:40 PM
Edited May 16, 2009 at 6:50 PM

Hi Andrei

Did you manage to get the API to connect in the end?  I'm also struggling with it - the stack trace is hinting that maybe the VMWareTasks API is to blame:

at Vestris.VMWareLib.VMWareInterop.Check(UInt64 errCode)
at Vestris.VMWareLib.VMWareJob.Wait[T](Object[] properties)
at Vestris.VMWareLib.VMWareJob.Wait[T](Object[] properties, Int32 index, Int32 timeoutInSeconds)






May 26, 2009 at 11:56 PM

I recommend writing the raw VixCOM code to connect at this point. If you can make that happen, VMWareTasks will do the same for you.

Mar 23, 2011 at 4:27 PM


Connection to VMWare server depends on version of VMWare Server.

If you want to connect to VMWare Server 2.x use this approach:

 "ConnectToVMWareVIServer(host.ip + ":" + host.port, host.user, host.password);"

ConnectToVMWareVIServer uses Constants.VIX_SERVICEPROVIDER_VMWARE_WORKSTATION as ServiceProviderType and https://{0}/sdk as URI that are legall when you want connect to VMWare server 2.x.

As ConnectToVMWareVIServer method  uses https protocol you should use correspondent port, the default one is 8333.