473,783 Members | 2,376 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What's the easiest way to read a MAC address 'n suck it into MS Access?

MLH
I would like to read a MAC address from at least one NIC
in a PC on which I have an Access 97 runtime app installed.
What's the least hassel method you know of?
Nov 13 '05 #1
7 2136
MLH <CR**@NorthStat e.net> wrote in news:pdrac1h2id idiqa9l7ej0j7ee 2fvvo7308@
4ax.com:
I would like to read a MAC address from at least one NIC
in a PC on which I have an Access 97 runtime app installed.
What's the least hassel method you know of?


Knock three times on the ceiling ...
Nov 13 '05 #2
MLH <CR**@NorthStat e.net> wrote in
news:pd******** *************** *********@4ax.c om:
I would like to read a MAC address from at least one NIC
in a PC on which I have an Access 97 runtime app installed.
What's the least hassel method you know of?


There's code here:

http://vbnet.mvps.org/index.html?cod...macaddress.htm

that does the job via NetBIOS. It's based on this MS Knowledge Base
article:

http://www.codeguru.com/resources/Network/

Note, however, that it will fail if the local machine has TCP/IP
over NetBIOS turned OFF (as anyone connected to the Internet and
running TCP/IP really ought to; otherwise your computer ends up with
a half dozen ports open to the Internet, none of which are useful
for anything other than exposing you to nasties out there on the
Internet). If NetBIOS over TCP/IP is turned off, the function there
returns 0.0.0.0.

I was able to get the code here to work with NetBIOS turned off:

http://vbnet.mvps.org/index.html?cod...ressremote.htm

I didn't think it *would*, since it said it as for remote IP
addresses, but it reported the same MAC Address as shows up in
ipconfig /all for my NIC. Note that it doesn't work with passing
127.0.0.1 (the loopback address).

The mention of ipconfig raises the alternative I had thought of
before Googling, which is to use shell to redirect ipconfig /all to
a text file, then open that text file and hunt for the line that
indicates Physical Address: -- but I don't do file I/O, so I can't
demonstrate how to use that.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #3
MLH
Well, there you go! I didn't read your post as thoroughly as I
should have. I didn't notice the /all parm on the ipconfig command.
Will that always return the hard coded address on the current NIC?
I sure hope so. If its that simple, I'm good to go. Many thx Mr
Fenton!

xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxx

I didn't think it *would*, since it said it as for remote IP
addresses, but it reported the same MAC Address as shows up in
ipconfig /all for my NIC. Note that it doesn't work with passing
127.0.0.1 (the loopback address).

The mention of ipconfig raises the alternative I had thought of
before Googling, which is to use shell to redirect ipconfig /all to
a text file, then open that text file and hunt for the line that
indicates Physical Address: -- but I don't do file I/O, so I can't
demonstrate how to use that.


Nov 13 '05 #4
MLH
Big thanks for the heads up on shelling out to run ipconfig /all.
Its likely the most reliable option. IPconfig will return a MAC addr
even when he cable is disconnected and netbios is NOT running.
I think that's gonna be he ticket!

BTW, how exactly does one pass a command like this
ipconfig /all > c:\mydir\myfile .txt
to a DOS window via the VBA Shell command? Do I
run something like this...
Dim RetVal
RetVal = Shell("c:\windo ws\system32\cmd .exe", 0)
And then use sendkeys to handle the
ipconfig /all > c:\mydir\myfile .txt
part? If that's the only way, I guess I'll write a DOS batch file
to run ipconfig /all > c:\mydir\myfile .txt and name it z~.bat or
something short 'n sweet.

I can handle the rest of it, opening a file for input, reading &
parsing to get what I want.

The mention of ipconfig raises the alternative I had thought of
before Googling, which is to use shell to redirect ipconfig /all to
a text file, then open that text file and hunt for the line that
indicates Physical Address: -- but I don't do file I/O, so I can't
demonstrate how to use that.


Nov 13 '05 #5
On Sun, 03 Jul 2005 10:09:51 -0400, MLH <CR**@NorthStat e.net> wrote:
Big thanks for the heads up on shelling out to run ipconfig /all.
Its likely the most reliable option. IPconfig will return a MAC addr
even when he cable is disconnected and netbios is NOT running.
I think that's gonna be he ticket!

BTW, how exactly does one pass a command like this
ipconfig /all > c:\mydir\myfile .txt
to a DOS window via the VBA Shell command? Do I
run something like this...
Dim RetVal
RetVal = Shell("c:\windo ws\system32\cmd .exe", 0)
And then use sendkeys to handle the
ipconfig /all > c:\mydir\myfile .txt
part? If that's the only way, I guess I'll write a DOS batch file
to run ipconfig /all > c:\mydir\myfile .txt and name it z~.bat or
something short 'n sweet.

I can handle the rest of it, opening a file for input, reading &
parsing to get what I want.

Hi
see other thread, but here is a copy: one way is-

1. Create a file C:\getconfig.ba t consisting of

ipconfig /all >C:\config.tx t

You can do this in code as required or make sure one is on the
machine.

Some batch commands, and I'm not sure whether ipconfig is one of them,
don't work properly from the run command but only from the "dos"
window,

2. launch this file using ShellWait (see http://www.mvps.org) (or just
shell out and doevents and wait a few seconds). Run it minimised.

3. open the file config.txt and parse out the information you want.
(Easier said than done, look for lines "physical address".Howeve r not
obvious which one is primary NIC. Also I'm not sure this is abolutely
always the physical address though it probably is.)

In the above instead of C: you should really get a suitable path, eg
use apiGetTempDir (also at http://www.mvps.org) though C:\temp would
probably be OK.

also there may be a different option to /all which gives you more
exactly what you need from ipconfig

4. Never use sendkeys.

I still think this is all too complicated!

David

Nov 13 '05 #6
MLH
yeah, I found out the hard way before reading this post.
Lots of wierd stuff (including loss of keyboard) - w/o any error
reported.
xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx

4. Never use sendkeys.

I still think this is all too complicated!

David


Nov 13 '05 #7
MLH <CR**@NorthStat e.net> wrote in
news:ek******** *************** *********@4ax.c om:
Big thanks for the heads up on shelling out to run ipconfig /all.
Its likely the most reliable option. IPconfig will return a MAC
addr even when he cable is disconnected and netbios is NOT
running.


What about when the NIC is disabled?

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #8

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

Similar topics

125
14851
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from software giant such as Microsoft SQL Server, Oracle, and Sybase? Is PostgreSQL reliable enough to be used for high-end commercial application? Thanks
1
1472
by: wASP | last post by:
Hi, I'm a newbie starting up with ASP.NET, and I'm getting off to a wonderful start - and when I tell you "wonderful" I'm being sarcastic. My OS is Win 2000 SP4 - and I'm using IE6. I've gotten IIS installed, along with the .NET framework.
121
10179
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode support IDEs are DreamWeaver 8 and Zend PHP Studio. DreamWeaver provides full support for Unicode. However, DreamWeaver is a web editor rather than a PHP IDE. It only supports basic IntelliSense (or code completion) and doesn't have anything...
10
2555
by: Nathaniel Branden | last post by:
Hello. This isn't really an Access question. I just want to know whether Tony Toews is retarded. In that vain, I have pasted down his last thirty or so posts for someone out there to respond. Is there anything substantial within all this bunk? ================================ >Comments: This message did not originate from the Sender address above. > It was remailed automatically by anonymizing remailer software.
24
2790
by: Bob Alston | last post by:
Most of my Access database implementations have been fairly small in terms of data volume and number of concurrent users. So far I haven't had performance issues to worry about. <knock on wood> But I am curious about what techniques those of you who have done higher volume access implementations use to ensure high performance of the database in a multi-user 100mbps LAN implementation??? Thanks
9
5254
by: Brian Hampson | last post by:
I am trying to determine all the groups which the current user has permissions to add a member. Here's my code: foreach (System.DirectoryServices.SearchResult ADSearchres in ADSearch.FindAll()) { //ActiveDs.ADSearchres.Properties
50
8546
by: lovecreatesbea... | last post by:
Could you extract examples of the characteristics of C itself to demonstrate what the advantages of C are? What are its pleasant, expressive and versatile characteristics? And what are its disadvantages?
14
3742
by: salad | last post by:
XML seems to be a hot technology buzzword. And it appears XML is supported in A2003. I am wondering if it could be used in the following scenario. I create an order record for the customer. This customer is one I do a lot of business with. I could create an email to send him a copy of the order. A more preferable approach would be to transfer to the customer the order and order items parts which could then be imported/used to update...
33
5709
by: James H. Newman | last post by:
I have a portion of code along the following lines: volatile unsigned char x ; unsigned int f(unsigned char *y) ; When I do unsigned int z = f(&x) ;
0
9643
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10315
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10083
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8968
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5379
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

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.