Re: vbs script

Steve Wolf wrote:
Can anyone give me the complete script to get the mac address of the current nic card or cards in the computer. Im not a programer, but i have a little vbs script that we use to print basic info about the computer and then we print it off and paste to the computer. I want the mac address, but every script I see on the net seems to give me more info than I need eg.

RAS Async Adapter mac addresses (there apper to be 3 of those mac addresses.) I just want the macs for the Nic's

The information you want is easily available with the included ipconfig
utility. It is just a matter of sifting out what you want. I threw
together the script below to extract the adapter description and MAC
number and print them to a file. I only have one Ethernet adapter, so I
couldn't test it on a system with multiple adapters. I can't guarantee
it will work, but I can guarantee it won't hurt anything. :-)

This is what the output on my computer looks like (without the line wrap):

Description . . . . . . . . . . . : Marvell Yukon 88E8053 PCI-E Gigabit
Ethernet Controller
Physical Address. . . . . . . . . : 00-01-29-A5-F1-41

The output could be fancied up with a little extra coding, but I wanted
to keep it simple. That is also why I use the same file (NicData.txt) to
hold the raw data and the filtered output.

Set WshShell=CreateObject("Wscript.Shell")"cmd /c ipconfig /all > NicData.txt",0,1)

Set fso=CreateObject("Scripting.FileSystemObject")
Set input=fso.OpenTextFile("NicData.txt")
dim data
do until input.AtEndOfStream
if instr(line,"Ethernet adapter") then call getData

Set output=fso.CreateTextFile("NicData.txt")
output.write data

sub getData()
if instr(line,"Description") then
data=data & line & vbCRLF
end if
if instr(line,"Physical Address") then
data=data & line & vbCRLF
exit sub
end if
end sub

"The future ain't what it used to be."
~ Yogi Berra ~