Page 1 of 1 1
Topic Options
#41139 - 2003-06-05 09:25 PM @ADDRESS options
rliang Offline
Fresh Scripter

Registered: 2003-03-10
Posts: 18
The @IPADDRESSx has the ability to report the IP address of upto 3 NICs. The @ADDRESS only reports the MAC of the 1st NIC. We have a problem with all our Dell Latitudes laptops whereby the integrated (3Com) NIC binds two adaptors to NT. The first adaptor is MS Loopback Adaptor. The @IPADDRESS0 reports 10.0.0.1 everytime, which is OK because I can always use @IPADDRESS1,2. The problem is @ADDRESS has no similar feature (to reference a different NIC), therefore all the Dell's are reporting an identical MAC address 204C4F4F5020. Any thing I can do other than pipe IPCONFIG /ALL to a text file and parse through it?
Top
#41140 - 2003-06-05 09:55 PM Re: @ADDRESS options
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Delete the M$ Loopback Adaptor?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#41141 - 2003-06-05 10:16 PM Re: @ADDRESS options
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
excuse me...
not sure what you mean... or want to do.

does those dell-latitudes have more than 3 adapters?
_________________________
!

download KiXnet

Top
#41142 - 2003-06-05 10:33 PM Re: @ADDRESS options
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
$ArrayofMAC=WMIQuery('MACAddress','Win32_NetworkAdapter')
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#41143 - 2003-06-05 11:29 PM Re: @ADDRESS options
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
You could try the folowing code:

code:
Break On
? 'MAC for NIC 1 = ' + GetMac(@IPAddress0)
? 'MAC for NIC 2 = ' + GetMac(@IPAddress1)
? 'MAC for NIC 3 = ' + GetMac(@IPAddress2)
? 'MAC for NIC 4 = ' + GetMac(@IPAddress3)
Get $x

Function GetMac($IpAdr)
Dim $oWMI,$NICs,$NIC,$ChkIP
$IpAdr = Join(Split($IpAdr),'')
$oWMI = GetObject("winmgmts:\\.\root\cimv2")
$NICs = $oWMI.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each $NIC In $NICs
For Each $ChkIP In $NIC.IPAddress
If $ChkIP = $IpAdr
$GetMac = Join(Split($NIC.MACAddress,':'),'')
EndIf
Next
Next
EndFunction

-Erik

Top
#41144 - 2003-06-05 11:29 PM Re: @ADDRESS options
rliang Offline
Fresh Scripter

Registered: 2003-03-10
Posts: 18
I can't delete the M$ Loopback Adaptor from 50 laptops.

The WMIQuery looks really interesting except WMI is not on most of our NT workstations.

I guess what I'm looking for is an @ADDRESS0,1,2 function so that I can query for the MAC address of any NICs that are present. It'd be great to see this in a future KIX release.

Thanks all

Top
#41145 - 2003-06-05 11:55 PM Re: @ADDRESS options
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
Sorry rliang,

I didn't see NT part

It wouldn't even help to ask Ruud for a type 4 in EnumIPInfo()
Where type 4 should return the MAC-address because NT as the only OS dosn't support this function

So sadly you are back to parsing the output of IPCONFIG /ALL

-Erik

Top
#41146 - 2003-06-06 01:42 AM Re: @ADDRESS options
rliang Offline
Fresh Scripter

Registered: 2003-03-10
Posts: 18
Erik

Thanks for the info.

I've got a very strange problem, I can't redirect my IPCONFIG /ALL to a text file. I've tried

Code 1
$ipcfg="ipconfig /all >c:\ipconfig.txt"
shell $ipcfg
This results in a syntax error and the entire IPCONFIG usage syntax being displayed on the screen

Code 2
$io=RedirectOutput("C:\IPCONFIG.TXT")
$ipcfg="ipconfig /all"
shell $ipcfg
$io=RedirectOutput("")
This shows the results of IPCONFIG /all on my screen instead of in the IPCONFIG.TXT file. What am I doing wrong. I had similar results with the NT ResKit utility GETMAC.EXE

Help!?!

Top
#41147 - 2003-06-06 01:56 AM Re: @ADDRESS options
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
hi rliang

try this:

SHELL "%COMSPEC% /C ipconfig /all >c:\ipconfig.txt"

-Shawn

Top
#41148 - 2003-06-06 01:59 AM Re: @ADDRESS options
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
This of course, is covered in the FAQ
Topic: Not quite everything you wanted to know about RUN and SHELL
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#41149 - 2003-06-06 06:44 AM Re: @ADDRESS options
rliang Offline
Fresh Scripter

Registered: 2003-03-10
Posts: 18
Shawn,

U da man! Thanks a heap-overflow! [Smile]

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.07 seconds in which 0.036 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org