One option is to use the Management classes and WMI.
Here's a sample..
using System.Management;
...
ManagementObjectSearcher query = new ManagementObjectSearcher("SELECT * FROM
Win32_NetworkAdapterConfiguration ") ;
ManagementObjectCollection queryCollection = query.Get();
foreach( ManagementObject mo in queryCollection ) {
string[] DNSsearch = (string[])mo["DNSServerSearchOrder"];
if((bool)mo["IpEnabled"]) { // IP enabled adapters only
foreach(string s in DNSsearch) {
Console.WriteLine( "DNS '{0}'", s);
}
}
}
Willy.
----- Original Message -----
From: "dave wanta" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, May 04, 2002 4:52 PM
Subject: [DOTNET] DNS servers
hi all,
Does anyone know how to retrieve the list of DNS servers that come up when you call
the command ipconfig /all ?
I need to do this in .NET, without calling any other programs (cmd.exe or
ipconfig.exe).
Thanks,
dave
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.