Click here to Skip to main content
15,910,878 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I would want to get the IP adress of the VMWare on which the application is installed

thanks

jeremy
Posted
Comments
Sandeep Mewara 27-Dec-10 5:18am    
Did you try to look at the IP address in VM? Just like you do for your system, you can get the IP of virtual systme.
JeremH 27-Dec-10 5:38am    
I 'm on the VM and i want the IP local and not the IP Host

DNSGetHostName()[^] might help.
 
Share this answer
 
Comments
JeremH 27-Dec-10 5:38am    
The methos get the IP host?
Hi,

You could do this using windows management instrumentation (wmi).

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Management;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            ManagementClass managementClass = new ManagementClass("Win32_NetworkAdapterConfiguration");
            ManagementObjectCollection managementObjectCollection = managementClass.GetInstances();
            foreach (ManagementObject managementObject in managementObjectCollection)
            {
                if ((bool)managementObject["ipEnabled"]) 
                {
                    string[] ipaddresses = (string[])managementObject["IPAddress"]; 
                }
            }
        }
    }
}


for more details you can look at this article:
Configuring TCP/IP Settings using WMI and C#[^]

Hope this is answering your query.

Valery.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900