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.

;=====================NetAdapters.vbs===================
Set WshShell=CreateObject("Wscript.Shell")
ret=WshShell.run("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
line=input.readLine
if instr(line,"Ethernet adapter") then call getData
loop
input.close

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

sub getData()
do
line=trim(input.readLine)
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
loop
end sub
;====================================================
--
Crash

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



Relevant Pages

  • vbs script
    ... Can anyone give me the complete script to get the mac address of the ... current nic card or cards in the computer. ... have a little vbs script that we use to print basic info about the ...
    (microsoft.public.scripting.vbscript)
  • Re: GetAdaptersInfo NetWorkAddress
    ... Smartphone (Windows Mobile) connected via ActiveSync. ... function returns two MAC addresses. ... Adapter? ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.win32.programmer.networks)
  • Re: [Full-Disclosure] Symantec AntiVirus and AOL
    ... >evice driver sets the NCD_VIRTUAL bit then they have done their duty as far as ... these routines encrypt GUIDs in a way that the original MAC ... Using the MAC address of the virtual adapter ... code "NT1003" when registering to take the TICSA exam at www.2test.com. ...
    (NT-Bugtraq)
  • Re: Error: -3253 Connection to the server failed or was dropped
    ... Entourage on my Mac. ... Test your network with tcpflow. ... Script to activate tcpflow: ...
    (microsoft.public.mac.office.entourage)
  • Re: Uniquely identifying PCs
    ... Display Adapter ... Network Adapter and its MAC Address ... and hard drives scanned for special info in the bad track lists. ...
    (comp.sys.ibm.pc.hardware.chips)