Afficher un message
Vieux 05/02/2008, 10h03   #2
Matthijs ten Seldam [MSFT]
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut RE: how can i get the ip address of a vm using virtual server com inte

An IP-address is something an OS understands. Note that you are managing a
VM, not an OS. Compare to a physical computer. It has no understanding of
IP-addresses. It understands hardware related properties like MAC address.

"i wanna be a ramone" wrote:

> ... now I am at the server side, I try to control the vm using the
> C#, I want to get the vm ip, I have already got the vm's name.
> how can i get the ip address of a vm using virtual server com
> interface?
>
> i can only do this so far...
> string name = CmdArgs[paramIndex];
> VMVirtualMachine machine =
> myVS.FindVirtualMachine(name);
> IVMNetworkAdapterCollection adapters =
> machine.NetworkAdapters;
> foreach (IVMNetworkAdapter ada in adapters)
> {
> output("ada");
> output(ada.EthernetAddress);
> output(ada.VirtualMachine.Name);
> output("net");
> VMVirtualNetwork net = ada.virtualNetwork;
> output(net.HostAdapter);
> output(net.Name);
> output("dhcp");
> VMDHCPVirtualNetworkServer dhcp =
> net.DHCPVirtualNetworkServer;
> output(dhcp.DefaultGatewayAddress);
> output(dhcp.DNSServers);
>
>
> }
>

  Réponse avec citation
 
Page generated in 0,05087 seconds with 9 queries