2

I'm trying to connect to VMWare Player machine using VMWareTasks (http://vmwaretasks.codeplex.com) but throw an error..

// declare a virtual host
using (VMWareVirtualHost virtualHost = new VMWareVirtualHost())
{
    string vmfile = @"D:\SIRETIH-Releases\SIRETIH_Virtual\pc-virtual\siretih.vmx";
    // connect to the host
    virtualHost.ConnectToVMWarePlayer(); // <<-- this line throws an error... 

    using (VMWareVirtualMachine virtualMachine = virtualHost.Open(vmfile))
    {
        virtualMachine.WaitForToolsInGuest();
        virtualMachine.LoginInGuest("siretih", "");
    }
}

I'm using Visual Studio 2010 (C#), VMWareTasks, VmWare Player 4.0.2 build-591240 (Windows OS), Windows 7 ...

virtual machine have vmware tools...

Do I need install anymore dll or api?

No se controló System.Exception
Message=Failed to connect: serviceProviderType="Player" hostName="" hostPort=0 username="" timeout=60
Source=Vestris.VMWareLib
  StackTrace:
en Vestris.VMWareLib.VMWareVirtualHost.Connect(ServiceProviderType serviceProviderType, String hostName, Int32 hostPort, String username, String password, Int32 timeout)
   en Vestris.VMWareLib.VMWareVirtualHost.ConnectToVMWarePlayer(Int32 timeoutInSeconds)
   en Vestris.VMWareLib.VMWareVirtualHost.ConnectToVMWarePlayer()utionContext, ContextCallback callback, Object state)

ConnectToVMWarePlayer() method has just one arg... there is a method "ConnectToVMWareVIServer" but I'm not using vmware server just player...

public void ConnectToVMWarePlayer(
    int timeoutInSeconds
)
Carlos Huchim
  • 102
  • 1
  • 11

2 Answers2

1

A bit late I know, but how about the following way of getting a VMWareVirtualMachine object you can use:

VMWareVirtualMachine virtualMachine = SetupVM(virtualHost, vmfile);

Just do a double check against null to make sure that you have an actual instance you can use. That is how I go about doing it, but maybe my use case is different than yours.

demongolem
  • 9,474
  • 36
  • 90
  • 105
0

I'm not sure if it is exactly the same, but the line of code you say is throwing an error needs the host and user credentials when connecting to VIServer:

virtualHost.ConnectToVMWareVIServer(VMServerHost, VMServerUserName, VMServerPassword);

Can you provide that information to the VMWareVirtualHost.ConnectToVMPlayer method?

Davin Tryon
  • 66,517
  • 15
  • 143
  • 132
  • virtualHost.ConnectToVMWareVIServer("localhost", "siretih", "joelvi"); throw the same error 'cause I have installed juts VMWare Player.. – Carlos Huchim Feb 21 '12 at 17:35