Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What network cards are installed on my computer?
Message
From
24/11/2004 11:06:27
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00963864
Message ID:
00964342
Views:
9
Nice Einar,
You wouldn't mind me copying this code I hope:)
Cetin

>Cetin,
>System.Management namespace put me on the right track. Using Windows Management Instrumentation (WMI) seems to get the job done.
>
>
>System.String sQuery = "select * from Win32_NetworkAdapter";
>ManagementObjectSearcher searcher = new ManagementObjectSearcher(sQuery);
>foreach (ManagementObject nic in searcher.Get())
>{
>  MessageBox.Show("Name: " + nic["Name"]+"\r\n" + "Network connection ID: " + nic["NetConnectionID"] + "\r\n" + "Status: " + nic["NetConnectionStatus"]);
>}
>
>
>or
>
>
>System.String sQuery = "SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE'";
>
>ManagementObjectSearcher searcher = new ManagementObjectSearcher(sQuery);
>foreach (ManagementObject nic in searcher.Get())
>{
>  MessageBox.Show("Hostname = " + nic["DNSHostName"] + "\r\n" + "Description = " + nic["Description"]);
>}
>
>
>I'll have to research more about WMI but it seems I am on the right track in the right direction.
>
>Einar
>
>>>Does anyone know how I can find out what network cards are installed on my computer at run-time?
>>>
>>>Thanks,
>>>Einar
>>Einar,
>>Search for GetAdaptersInfo. I know it exists in win32API and CE.NET but which class and how I don't know (System.Management.Instrumentation?).
>>Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform