VMware VIX API FindItems () method never returned when requested for registered virtual machines

I am using VMware Workstation 6.5 for Windows Vista x64. I am trying to write C # code that uses the VMware Vix v1.6.1 COM API to get a list of registered virtual machines.

The code I am using looks like this:

using System;
using VixCOM;

namespace ConsoleApplication48
{
    internal class Program
    {
        private static void Main()
        {
            var lib = new VixLibClass();
            object results = null;

            var job = lib.Connect(Constants.VIX_API_VERSION, Constants.VIX_SERVICEPROVIDER_VMWARE_WORKSTATION, null, 0,
null, null, 0, null, null);

            var err = job.Wait(new[] {Constants.VIX_PROPERTY_JOB_RESULT_HANDLE}, ref results);

        if (lib.ErrorIndicatesFailure(err))
            Console.WriteLine("Error: " + err);

        var host = (IHost)((object[])results)[0];

        job = host.FindItems(Constants.VIX_FIND_REGISTERED_VMS, null, -1, new DiscoveryCallback(lib));
        job.WaitWithoutResults();

        host.Disconnect();
    }
}

internal class DiscoveryCallback : ICallback
{
    protected VixLibClass lib;

    public DiscoveryCallback(VixLibClass lib)
    {
        this.lib = lib;
    }

    #region ICallback Members

    public void OnVixEvent(IJob job, int eventType, IVixHandle moreEventInfo)
    {
        // this method is never called
    }

    #endregion
    }
}

      

I am aware that the COM DLL is 32-bit, so I made sure the test application is compiled as 32-bit. I also made sure that all VMware services are running.

There are no exceptions, no errors (as far as I can see) and events written to the event log.

Oddly enough, the above code works when I try to get a list of running virtual machines using the VIX_FIND_RUNNING_VMS constant.

Any ideas on what might be causing this?

Thank,

Arnie

+1


source to share


1 answer


Rapid update of the situation.

I took a closer look at the official documentation for the FindItems () method. VIX_FIND_RUNNING_VMS constant is not specified as a supported parameter - only VIX_FIND_RUNNING_VMS constant.

I assume this means that the VIX API currently does not provide any way to get a list of virtual machines registered with a VMware workstation instance.



This also explains why the vmrun.exe command line utility does not offer any way to register registered virtual machines.

I guess I just need to wait until the next version of the VIX API is released.

+1


source







All Articles