#41139 - 2003-06-05 09:25 PM
@ADDRESS options
|
rliang
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
|
|
|
|
#41142 - 2003-06-05 10:33 PM
Re: @ADDRESS options
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
$ArrayofMAC=WMIQuery('MACAddress','Win32_NetworkAdapter')
|
|
Top
|
|
|
|
#41143 - 2003-06-05 11:29 PM
Re: @ADDRESS options
|
kholm
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
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
|
|
|
|
#41146 - 2003-06-06 01:42 AM
Re: @ADDRESS options
|
rliang
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
|
|
|
|
#41149 - 2003-06-06 06:44 AM
Re: @ADDRESS options
|
rliang
Fresh Scripter
Registered: 2003-03-10
Posts: 18
|
Shawn,
U da man! Thanks a heap-overflow!
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 756 anonymous users online.
|
|
|