#61436 - 2001-12-19 03:04 PM
Re: How do you obtain "active" IPADDRESS0,1,2 etc..
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
You guys are picky... wanting code to actually work It also seems to work under XP... (of course 2k and xp are about the same thing...) code:
; find ipconfig info (for up to 10 adapters) $interfaces="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces" $nic=0 dim $ipaddrs[9] dim $gateway[9] dim $subnetm[9] dim $namesvr[9] :nicloop $niccard=enumkey("$interfaces",$nic) if @error=0 $Isdhcp=readvalue("$interfaces\$niccard","EnableDHCP") if $Isdhcp="1" $adddhcp="Dhcp" else $adddhcp="" endif $ipaddrs[$nic]=readvalue("$interfaces\$niccard","$adddhcp"+"IPAddress") $gateway[$nic]=readvalue("$interfaces\$niccard","$adddhcp"+"DefaultGateway") $subnetm[$nic]=readvalue("$interfaces\$niccard","$adddhcp"+"SubnetMask") $namesvr[$nic]=readvalue("$interfaces\$niccard","$adddhcp"+"NameServer") ; trim off pipe char from end of reg_multi $ipaddrs[$nic]=left($ipaddrs[$nic],len($ipaddrs[$nic])-1) $gateway[$nic]=left($gateway[$nic],len($gateway[$nic])-1) $subnetm[$nic]=left($subnetm[$nic],len($subnetm[$nic])-1) if $gateway[$nic] > "0.0.0.0" $mygw=$gateway[$nic]+"|"+$mygw ? "$adddhcp NIC number $nic" ? "IP :"$ipaddrs[$nic] ? "GW :"$gateway[$nic] ? "SM :"$subnetm[$nic] ? "NS :"$namesvr[$nic] endif $nic=val($nic)+1 goto nicloop endif $mygw=left($mygw,len($mygw)-1) ? "My Gateways are: "$mygw
output for me is:
code:
NIC number 1 IP :192.168.110.12 GW :192.168.110.1 SM :255.255.255.0 NS :65.32.2.130,65.32.1.70 My Gateways are: 192.168.110.1
[ 19 December 2001: Message edited by: Radimus ]
|
|
Top
|
|
|
|
How do you obtain "active" IPADDRESS0,1,2 etc..
|
NTDOC
|
2001-12-18 02:37 AM
|
Re: How do you obtain "active" IPADDRESS0,1,2 etc..
|
bleonard
|
2001-12-18 05:39 PM
|
Re: How do you obtain "active" IPADDRESS0,1,2 etc..
|
Radimus
|
2001-12-18 06:44 PM
|
Re: How do you obtain "active" IPADDRESS0,1,2 etc..
|
NTDOC
|
2001-12-19 01:35 AM
|
Re: How do you obtain "active" IPADDRESS0,1,2 etc..
|
bleonard
|
2001-12-19 02:11 AM
|
Re: How do you obtain "active" IPADDRESS0,1,2 etc..
|
NTDOC
|
2001-12-19 08:40 AM
|
Re: How do you obtain "active" IPADDRESS0,1,2 etc..
|
Radimus
|
2001-12-19 03:04 PM
|
Re: How do you obtain "active" IPADDRESS0,1,2 etc..
|
bleonard
|
2001-12-19 04:43 PM
|
Re: How do you obtain "active" IPADDRESS0,1,2 etc..
|
Les
|
2001-12-19 05:22 PM
|
Re: How do you obtain "active" IPADDRESS0,1,2 etc..
|
bleonard
|
2001-12-19 05:51 PM
|
Re: How do you obtain "active" IPADDRESS0,1,2 etc..
|
Radimus
|
2001-12-19 08:47 PM
|
Re: How do you obtain "active" IPADDRESS0,1,2 etc..
|
NTDOC
|
2001-12-19 09:27 PM
|
Re: How do you obtain "active" IPADDRESS0,1,2 etc..
|
NTDOC
|
2001-12-19 10:31 PM
|
Re: How do you obtain "active" IPADDRESS0,1,2 etc..
|
Radimus
|
2001-12-19 11:45 PM
|
Re: How do you obtain "active" IPADDRESS0,1,2 etc..
|
NTDOC
|
2001-12-20 12:00 AM
|
Re: How do you obtain "active" IPADDRESS0,1,2 etc..
|
Les
|
2001-12-20 10:50 PM
|
Re: How do you obtain "active" IPADDRESS0,1,2 etc..
|
Radimus
|
2001-12-20 11:36 PM
|
Re: How do you obtain "active" IPADDRESS0,1,2 etc..
|
Anonymous
|
2001-12-27 02:37 PM
|
Re: How do you obtain "active" IPADDRESS0,1,2 etc..
|
bleonard
|
2001-12-27 06:46 PM
|
Re: How do you obtain "active" IPADDRESS0,1,2 etc..
|
Anonymous
|
2001-12-27 07:31 PM
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|