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);
>
>
> }
>
|