getting RunningVirtualMachines is very slow

33 views
Skip to first unread message

Paul Grishin

unread,
Mar 28, 2015, 6:09:13 PM3/28/15
to vmwar...@googlegroups.com

Hi,

I’m trying to list all running VM on ESX Server (I have more than 100 VMs running). I use this code:

VMWareVirtualHost virtualHost = new VMWareVirtualHost();

virtualHost.ConnectToVMWareVIServer("__ESX_HOST_IP_", "_USERNAME_", "_PASSW_");

string msgline = "";

foreach (VMWareVirtualMachine VMnode in virtualHost.RunningVirtualMachines)

                 {

                     msgline += VMnode.PathName;

                 }

MessageBox.Show(msgline);

 

It takes about 5 minutes or so to get final MessageBox. It seems that when I'm trying to get RunningVirtualMachines property it gets VM one by one in timeout about 3 sec.

Is there a way to optimize this code?

Or maybe some different way?

Daniel Doubrovkine

unread,
Mar 30, 2015, 2:40:27 PM3/30/15
to vmwar...@googlegroups.com
I would dig a bit deeper to see which VixCOM API takes a long time, but I suspect you're not going to find anything dramatically faster. See if the property that returns all the VMs is any different, that might be good enough.

--
You received this message because you are subscribed to the Google Groups "vmwaretasks" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vmwaretasks...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages