PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms.virtualserver > how can i get the ip address of a vm using virtual server cominterface?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
how can i get the ip address of a vm using virtual server cominterface?

Réponse
 
LinkBack Outils de la discussion
Vieux 31/01/2008, 03h40   #1
i am a ramone
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut how can i get the ip address of a vm using virtual server cominterface?

hi all
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
Vieux 31/01/2008, 14h49   #2
Tim Walsh
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 interface?

Assuming the VM is running, and is a Windows machine you can probably use a
script like this to obtain the IP Address
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set IPConfigSet = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")

For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
WScript.Echo IPConfig.IPAddress(i)
Next
End If
Next
"i am a ramone" <pythonow@gmail.com> wrote in message
news:01ac98fc-0b8d-431e-b0dd-1c4f1a5b0f43@p69g2000hsa.googlegroups.com...
> hi all
> 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
Vieux 01/02/2008, 06h01   #3
i am a ramone
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how can i get the ip address of a vm using virtual server cominterface?

Thanks for the vbscript u given. Actually I am programming in C# and
using the Virtual Server COM interfaces, would u please point how to
finish the work by using the Virtual Server COM interfaces in C#?
thank u
  Réponse avec citation
Vieux 01/02/2008, 06h35   #4
i am a ramone
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how can i get the ip address of a vm using virtual server cominterface?

en... 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.
  Réponse avec citation
Vieux 01/02/2008, 12h43   #5
Tim Walsh
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 interface?

I'm not a C# programmer, but I found on the following web site
(http://www.howtogeek.com/howto/progr...hostname-in-c/)
this after a short search

string howtogeek = "www.howtogeek.com";
IPAddress[] addresslist = Dns.GetHostAddresses(howtogeek);

foreach (IPAddress theaddress in addresslist)
{
Console.WriteLine(theaddress.ToString());
}


"i am a ramone" <pythonow@gmail.com> wrote in message
news:521d63d5-8903-41c2-bf2e-daea2be39773@e25g2000prg.googlegroups.com...
Thanks for the vbscript u given. Actually I am programming in C# and
using the Virtual Server COM interfaces, would u please point how to
finish the work by using the Virtual Server COM interfaces in C#?
thank u


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 23h53.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,09529 seconds with 13 queries