Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / February 2008

Tip: Looking for answers? Try searching our database.

Win32_Networkadapterconfiguration and DNSDomain

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
auldh - 19 Feb 2008 22:21 GMT
hello,
i have gotten my code running well. it collect the network card information
by way of Win32_networkadapterconfiguration but when it comes to the
DNSDomain output i'm get null. always null.
i run the ipconfig /all and there is data. but using the win32_... i get null.

int i = 0;
bool bStat = false;
ManagementObjectSearcher query = new ManagementObjectSearcher("SELECT * FROM
Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE'");
ManagementObjectCollection queryCollection = query.Get();
i = queryCollection.Count;
string[] addresses;
foreach (ManagementObject snic in queryCollection)
{
   XHF.defInst.xprhotfixviewer.Text += "NIC Name:     " + "\t" +
snic["Description"] + "\r\n";
   XHF.defInst.xprhotfixviewer.Text += "MAC Address:  " + "\t" +
snic["MACAddress"] + "\r\n";
   if (snic["IPAddress"] != null)
   {
       addresses = (string[])snic["IPAddress"];
       foreach (string ipaddress in addresses)
       {
           XHF.defInst.xprhotfixviewer.Text += "IP Address:   " + "\t" +
ipaddress + "\r\n";
       }
   }
   else
       XHF.defInst.xprhotfixviewer.Text += "IP Address:   " + "\t";
   XHF.defInst.xprhotfixviewer.Text += "DHCP Server:  " + "\t" +
snic["DHCPServer"] + "\r\n";
   XHF.defInst.xprhotfixviewer.Text += "DNS Domain:   " + "\t" +
snic["DNSDomain"] + "\r\n";

according to documentation this is a "string".
Willy Denoyette [MVP] - 20 Feb 2008 07:55 GMT
> hello,
> i have gotten my code running well. it collect the network card
[quoted text clipped - 35 lines]
>
> according to documentation this is a "string".

DNSDomain contains the IP domain name if the system runs a DNS, I guess this
is not the case here.

Willy.
auldh - 24 Feb 2008 21:36 GMT
so what is my next option? i know "ipconfig" does get it what am i doing
wrong or how can i ensure the data?

> > hello,
> > i have gotten my code running well. it collect the network card
[quoted text clipped - 40 lines]
>
> Willy.
Willy Denoyette [MVP] - 25 Feb 2008 11:39 GMT
> so what is my next option? i know "ipconfig" does get it what am i doing
> wrong or how can i ensure the data?

What ipconfig info are you actually talking about?
All ipconfig returns are the "DNS server addresses" that can be used for IP
address resolution, but this is not what WMI's "DNSDomain" is all about. The
DSN server addresses are found in the "DNSServerSearchOrder" property.

Willy.

>> > hello,
>> > i have gotten my code running well. it collect the network card
[quoted text clipped - 43 lines]
>>
>> Willy.
auldh - 25 Feb 2008 15:04 GMT
hello Willy,
i checked my code and i do collect the "DNSServerSearchOrder" this returns
the ip address for the DNS server.

i was looking for the "Primary DNS Suffix" string which a domain computer
usually has. that information i don't seem to find. maybe this is stored some
where else. i would like to collect for the local and remote computer.

> > so what is my next option? i know "ipconfig" does get it what am i doing
> > wrong or how can i ensure the data?
[quoted text clipped - 53 lines]
> >>
> >> Willy.
Willy Denoyette [MVP] - 25 Feb 2008 21:26 GMT
On a local system and supposing you are running on V2 of the framework, you
can get the DomainName property from the IPGlobalProperties
class(System.Net.NetworkInformation namespace).

On a remote system, you'll have to get the Domain property of
Win32_ComputerSystem using System.Management.

Willy.

> hello Willy,
> i checked my code and i do collect the "DNSServerSearchOrder" this returns
[quoted text clipped - 68 lines]
>> >>
>> >> Willy.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.