473,549 Members | 2,604 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get Mac address

Hi

I need to get a unique identifier to a machine, I chose to use a MAC
address. The problem I am having is that the methods I have found on
the internet and through Google groups aren't sufficient for what I
require.

Option 1 - using WMI
Unfortunately I'm using Framework 1.1
http://groups.google.co.uk/group/mic...3183a4dd?hl=en

Option 2 - Using Send ARP
The machine isn't always connected to a network so it doesn't always
have an IP address, no IP no ARP packets.

Any help would be much appreciated.

Feb 14 '06 #1
5 6781
Hi,
what is wrong with WMI ? it does work in 1.1 , use this code:

ManagementClass mc = new ManagementClass ("Win32_Network Adapter");
foreach (ManagementObje ct mo in mc.GetInstances ())
{
string macAddr = mo["MACAddress "] as string;
if ( macAddr != null && macAddr.Trim() != "" )
return macAddr.ToStrin g();
}
Note that it does not work in win9X
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

<ad*****@awtxgl obal.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
Hi

I need to get a unique identifier to a machine, I chose to use a MAC
address. The problem I am having is that the methods I have found on
the internet and through Google groups aren't sufficient for what I
require.

Option 1 - using WMI
Unfortunately I'm using Framework 1.1
http://groups.google.co.uk/group/mic...3183a4dd?hl=en

Option 2 - Using Send ARP
The machine isn't always connected to a network so it doesn't always
have an IP address, no IP no ARP packets.

Any help would be much appreciated.

Feb 14 '06 #2
Windows Management Instrumentation ....

using System.Manageme nt;

...

ManagementClass mc = new ManagementClass ("Win32_Network Adapter");

I had some trouble getting that code to work .....

error CS0234: The type or namespace name 'Management' does not exist in
the class or namespace 'System' (are you missing an assembly
reference?)

Feb 14 '06 #3
Hi,

<ad*****@awtxgl obal.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
Windows Management Instrumentation ....

using System.Manageme nt;

..

ManagementClass mc = new ManagementClass ("Win32_Network Adapter");

I had some trouble getting that code to work .....

error CS0234: The type or namespace name 'Management' does not exist in
the class or namespace 'System' (are you missing an assembly
reference?)


You have to include a reference to System.Manageme nt in "Add reference"
form the project menu
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Feb 14 '06 #4
I don't get what's the differenc between that and putting a using
statement in?

Feb 14 '06 #5
Do'h school boy error, I see what I've done now.

Thanks for your help Ignacio.

Feb 14 '06 #6

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

Similar topics

21
15668
by: Alexander N. Spitzer | last post by:
If I have a machine with 3 virtual IP addresses (192.168.1.), how can I start 3 instances of the same RMI application (each started with different properties/configs), each listening on the port 1234, but each instance binds to a different ip address. that is to say: instance #1 binds to 192.168.1.5/port 1234 instance #2 binds to...
8
4583
by: YAN | last post by:
Hi, I want to get the mac address from a machine, which i have the IP address of that machine, how can i do that? I know how to get the mac address of the local machine from the following code: Dim mc As System.Management.ManagementClass Dim mo As System.Management.ManagementObject mc = New...
7
21279
by: Privacy Advocate | last post by:
//crossposted to: comp.lang.javascript, alt.comp.lang.javascript in an effort to get factual answers from JavaScript experts// Simply put; Is it possible to obtain the real (actual) IP address of someone (client) that visits a web site through an anonymous proxy if this person ONLY has JavaScript enabled in their browser? This is NOT a...
33
3132
by: baumann.Pan | last post by:
hi all, i want to get the address of buf, which defined as char buf = "abcde"; so can call strsep(address of buf, pointer to token);
4
6278
by: andreas.w.h.k. :-\) | last post by:
How do I change the address location in the wsdl <wsdl:port name="SearchSoap12" binding="tns:SearchSoap12"> <soap12:address location="http://searchservices/engine/search.asmx" /> </wsdl:port> Anderas
1
2923
by: Phoenix_ver10 | last post by:
I have a mailing list with multiple names going to the same addresses. I need one address with all the names for that address on it. I checked out the example on microsoft's site, but A: It doesn't work (error that there is an extra parenthise (sp?) ) and B: Will only let in two names for each record. If there are three, the middle on is...
1
2350
by: Jamie J. Begin | last post by:
I'm very new to the world of Python and am trying to wrap my head around it's OOP model. Much of my OOP experience comes from VB.Net, which is very different. Let's say I wanted to create an object that simply outputted something like this: Developer Detroit Michigan
6
7022
by: Nicolas Noakes | last post by:
Hello, I would like to convert to following process to code. Any advice is welcome. I have a hardware device which requires the this procedure to set it's IP address. First create an static ARP entry for the device's MAC address and the desired IP address. Then telnet to this IP address on TCP port 1. This will set the device to...
36
3362
by: Julienne Walker | last post by:
Ignoring implementation details and strictly following the C99 standard in terms of semantics, is there anything fundamentally flawed with describing the use of a (non-inline) function as an address? I keep feeling like I'm missing something obvious. -Jul To keep things in context, this is in reference to describing functions to a...
1
3113
by: saravanatmm | last post by:
I need javascript code for validate the email address. Email address field cannot allowed the capital letters, special characters except '@' symbol. But can allowed the small letters, numeric numbers. Now i use this script for validate the email address. But it allows the cpital letters otherwise its working correctly. SCRIPT FUNCTION ...
0
7541
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7464
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7979
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7826
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6065
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5385
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3512
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3493
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
781
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.