GET Registered Virtual Machines

Oct 25, 2009 at 7:25 PM

Hi,

I'm trying to get Registered virtual machines with Virtual server 1.0.9. Here's the code that I write:

"string _aux = string.Empty;
            if (_connected)
            {
                foreach (VMWareVirtualMachine vm in _vmhost.RegisteredVirtualMachines)
                {
                    if (_aux == string.Empty)
                    {
                        _aux += vm.PathName;
                    }
                    else
                    {
                        _aux = ";" + vm.PathName;
                    }
                }
            }
            return string.Empty;

"

The problem are that "RegisteredVirtualMachines" function never return virtual machines.

Thanks for your help and excuse my english,

Jordi

Coordinator
Oct 26, 2009 at 6:23 AM

RegisteredVirtualMachines is implemented like this:

                VMWareJobCallback callback = new VMWareJobCallback();
                using (VMWareJob job = new VMWareJob(_handle.FindItems(
                    Constants.VIX_FIND_REGISTERED_VMS, null, -1, callback),
                    callback))
                {
                    object[] properties = { Constants.VIX_PROPERTY_FOUND_ITEM_LOCATION };
                    foreach (object[] runningVirtualMachine in job.YieldWait(properties, VMWareInterop.Timeouts.FindItemsTimeout))
                    {
                        yield return this.Open((string)runningVirtualMachine[0]);
                    }
                }

Looking at the doc of FindItems it's unclear whether t would work with Server 1.0, but this thread says it's simply not supported.