How to retrieve guest vm names

Oct 14, 2009 at 7:44 PM

Hello all,

I'm new to using the VMWareTasks wrapper, but I know it will work perfectly for the .NET application that I'm developing.  I'm working on an application that needs to be able to retrieve the guest vm names and present them to the user.  I initially thought that I could accomplish this through the use of the "RegisteredVirtualMachines" property.  I can successfully use this to iterate through the guest machines, but I'm not seeing a reference to the actual machine name.  Is there a way to retrieve the name this way or is there some other way to accomplish this?   If anyone could provide a simple example that would be very helpful too.

Coordinator
Oct 19, 2009 at 8:46 PM

Interestingly there seems to be no way of doing this. The only properties that are documented are the following. So you can get the .vmx file path, but not the vm name as it appears in the management tools. Maybe VixCOM forum has a better clue.

        public const int VIX_PROPERTY_VM_IN_VMTEAM = 128;
        public const int VIX_PROPERTY_VM_IS_RECORDING = 236;
        public const int VIX_PROPERTY_VM_IS_REPLAYING = 237;
        public const int VIX_PROPERTY_VM_IS_RUNNING = 196;
        public const int VIX_PROPERTY_VM_MEMORY_SIZE = 106;
        public const int VIX_PROPERTY_VM_NUM_VCPUS = 101;
        public const int VIX_PROPERTY_VM_POWER_STATE = 129;
        public const int VIX_PROPERTY_VM_READ_ONLY = 107;
        public const int VIX_PROPERTY_VM_SUPPORTED_FEATURES = 197;
        public const int VIX_PROPERTY_VM_TOOLS_STATE = 152;
        public const int VIX_PROPERTY_VM_VMTEAM_PATHNAME = 105;
        public const int VIX_PROPERTY_VM_VMX_PATHNAME = 103;
Oct 28, 2009 at 12:23 PM

Hi jgcabuk.

Is this the same list that is returned from powershell with the command "get-cm | select name"?

If so (I don't have the management tools to see if this matches), you could call that powershell command, perhaps.