473,405 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Implementing the getmac.exe functionality

Hello!

The getmac.exe program under Windows XP lists the MAC adresses of the
physical network cards. How may I obtain these MAC addresses using .NET?
Best regards,

Henrik Dahl
Nov 16 '05 #1
4 2700
Henrik,

I would use the classes in the System.Management namespace to select all
instances of the Win32_NetworkAddress class. Once you get all instances of
that, you can check the MACAddress property to get the MAC address of the
network adapter. Remember, these are WMI classes, not .NET classes.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Henrik Dahl" <He********@community.nospam> wrote in message
news:O5**************@TK2MSFTNGP10.phx.gbl...
Hello!

The getmac.exe program under Windows XP lists the MAC adresses of the
physical network cards. How may I obtain these MAC addresses using .NET?
Best regards,

Henrik Dahl

Nov 16 '05 #2
Hello Nicholas,

Yes, I know that, but there's one detail I don't know. I don't want all
instances, only the physical ones and I don't know how to identify whether
the given instance is modelling a physical device. There are plenty of
logical devices. Do you know how to identify the physical devices?
Best regards,

Henrik Dahl

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:Oc**************@TK2MSFTNGP12.phx.gbl...
Henrik,

I would use the classes in the System.Management namespace to select all instances of the Win32_NetworkAddress class. Once you get all instances of that, you can check the MACAddress property to get the MAC address of the
network adapter. Remember, these are WMI classes, not .NET classes.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Henrik Dahl" <He********@community.nospam> wrote in message
news:O5**************@TK2MSFTNGP10.phx.gbl...
Hello!

The getmac.exe program under Windows XP lists the MAC adresses of the
physical network cards. How may I obtain these MAC addresses using .NET?
Best regards,

Henrik Dahl


Nov 16 '05 #3
Hi Henrik,

We have reviewed this issue and are currently researching on it. We will
update you ASAP. Thanks for your patience!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #4
Hi

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to list all the physical
network adapter using WMI. If there is any misunderstanding, please feel
free to let me know.

Here I've written some sample code for you. HTH.

SelectQuery query = new SelectQuery("Win32_NetworkAdapterConfiguration",
"IPEnabled='true'");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
foreach(ManagementObject adapterConfig in searcher.Get())
{
Console.WriteLine("\nNewtork Adapter: {0}\nMAC Address: {1}",
adapterConfig["Description"], adapterConfig["MACAddress"]);
}

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Ben | last post by:
Hi all, I implemented a stack in C++ in 2 different ways and I'd like to know which approach is better than the other.. and if there is any difference between the two? I'd also like to know if...
2
by: Dmitri Zhukov | last post by:
Hello everyone, I am implementing software which has a medium sized number of text strings (max 100K) which are represented in a listbox. I want user to be able to search the string by typing...
2
by: philip.mckee | last post by:
Hi Looking for some very general advice. I have a classic asp content management application which I am porting to ASP.NET. The database is SQL server, and it is hoped that we can leverage this...
0
by: ZA_AJR | last post by:
Hi All I have a class (aClass, derived from aBaseClass) with implements an interface IMyInterface. aClass also has a private member of type aNotherClass which raises various events. I would like...
0
by: Rahtgaz | last post by:
Hello everyone, I'm wanting to start implementation of a pet project game IO mechanism. The game is console based. A cross between MUD and Rogue types. For I/O operations I'll be using ncurses...
6
by: Joseph Geretz | last post by:
I have the following class which I am serializing and passing back and forth between my Web Service application and the client. public class Token : SoapHeader { public string SID; public...
5
by: koonda | last post by:
Hi all, I am a student and I have a project due 20th of this month, I mean May 20, 2007 after 8 days. The project is about creating a Connect Four Game. I have found some code examples on the...
4
by: zacks | last post by:
Most applications whose purpose is to work with various types of files implement a "Most Recent Files" list, where the last, say, four files accessed by the application can quickly be re-opened by...
8
by: nickooooola | last post by:
Hello to all I'm about to write a simulator for a microcontroller in python (why python? because I love it!!!) but I have a problem. The registry of this processor are all 8 bit long (and 10...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.