How to get ip address of Remote machine using windowsmanagement class or Win32
We can get ip address of remote machine easily,but some time we cant all ip address on remote.now we will see how to get all ip address of Remote machine?
We can get ip address of remote machine easily,but some time we cant all ip address on remote. Now we will see how to get all ip address of Remote machine?
string getIP(string strServerName)
{
string ip = string.Empty;
string ip1 = string.Empty;
string IPFinal = string.Empty;
ArrayList collectIPlast = new ArrayList();
ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE'");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);
ManagementObjectCollection queryCollection = searcher.Get();
foreach (ManagementObject mo in queryCollection)
{
string[] addresses = (string[])mo["IPAddress"];
foreach (string ipaddress in addresses)
{
collectIPlast.add(ipaddress.ToString());
}
}
}
