retrieve MAC from registry ?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

retrieve MAC from registry ?

#1 Post by Ed Dyreen » 27 Sep 2011 02:26

'
Is there a way to retrieve MAC from registry instead of the SLOW GetMAC.EXE :?:

trap
Posts: 4
Joined: 10 Jan 2011 07:20
Location: Norway
Contact:

Re: retrieve MAC from registry ?

#2 Post by trap » 27 Sep 2011 03:31

Code: Select all

getmac >> MAC.txt

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: retrieve MAC from registry ?

#3 Post by Ed Dyreen » 27 Sep 2011 03:34

'
from registry :shock:

trap
Posts: 4
Joined: 10 Jan 2011 07:20
Location: Norway
Contact:

Re: retrieve MAC from registry ?

#4 Post by trap » 27 Sep 2011 06:56

Idk how you get it from registry :) Why isnt that batch enough? Why do you call it slow? :p

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: retrieve MAC from registry ?

#5 Post by Ed Dyreen » 27 Sep 2011 07:15

'
GetMAC takes around 3000ms on my machine, that's about 900.000.000.000 instructions wasted on a 3GHz pc.
RegRead is much faster, I just don't know which key :|

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: retrieve MAC from registry ?

#6 Post by dbenham » 27 Sep 2011 09:15

I don't know much about the registry or MACs, but a Google search indicates it is possible to over-ride the physical MAC specified by the card by using the registry. But based on my casual search it doesn't look like the registry typically has the value unless it has been over-ridden.

Why not use IPCONFIG /ALL :?: - The MAC is listed under "Physical Address"

IPCONFIG /ALL is much faster than GETMAC on my machine.

This works on my Vista machine with a single NIC:

Code: Select all

for /f "tokens=3 delims=:. " %%A in ('ipconfig /all^|findstr /c:"Physical Address"') do set MAC=%%A


Dave Benham

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: retrieve MAC from registry ?

#7 Post by Ed Dyreen » 27 Sep 2011 09:39

'
Love ya :D
I'll just add an 'if defined' construct to that, I program in VM so I have at least 3NIC's.
Luckily the physical NIC is always listed first.

Vista you say, hmm I hope you have autorun.virus disabled :lol:

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: retrieve MAC from registry ?

#8 Post by Ed Dyreen » 27 Sep 2011 22:05

'
I don't know much about the registry or MACs,
I use MAC to differentiate computer systems from one another.

That way my program can identify who it's dealing with, and personalize the target.
This only works for systems powered with a physical NIC !

If someone knows a better way, I'd like to know :wink:

Post Reply