Look for Bound IP Addresses
Keywords: find bound IP addresses ipaddr
Question:
Is there a way (I am sure there is) that you can look for the bound IPs under 95/98 with WinBatch?
Answer:
In WinNT, rough sample code follows:
hndl=regopenkey(@regmachine,"Software\microsoft\windows nt\currentversion\NetworkCards")
Netcards=regquerykeys(hndl)
ipaddress=""
For i = 1 to itemcount(netcards,@tab)
dhcpip=""
ip=""
mask=""
dhcpmask=""
card=itemextract(i,netcards,@tab)
service=regqueryvalue(@regmachine,"Software\microsoft\windows nt\currentversion\NetworkCards\%card%[servicename]")
nic=regexistkey(@regmachine,"system\currentcontrolset\services\%service%\parameters\tcpip")
if nic == @true
if regexistvalue(@regmachine,"system\currentcontrolset\services\%service%\parameters\tcpip[ipaddress]")
ip=RegQueryMulSz(@regmachine,"system\currentcontrolset\services\%service%\parameters\tcpip[ipaddress]", ":")
endif
if regexistvalue(@regmachine,"system\currentcontrolset\services\%service%\parameters\tcpip[subnetmask]")
mask=regquerymulsz(@regmachine,"system\currentcontrolset\services\%service%\parameters\tcpip[subnetmask]", ":")
endif
if regexistvalue(@regmachine,"system\currentcontrolset\services\%service%\parameters\tcpip[DHCPipaddress]")
dhcpip=RegQueryvalue(@regmachine,"system\currentcontrolset\services\%service%\parameters\tcpip[DHCPipaddress]")
endif
if regexistvalue(@regmachine,"system\currentcontrolset\services\%service%\parameters\tcpip[dhcpsubnetmask]")
dhcpmask=regqueryvalue(@regmachine,"system\currentcontrolset\services\%service%\parameters\tcpip[DHCPsubnetmask]")
endif
endif
if nic==@true
if dhcpip<>"0.0.0.0" && dhcpip<>""
ipaddress=strcat(ipaddress,Service," DHCP:",dhcpip,":",dhcpmask,@tab)
else
ipaddress=strcat(ipaddress,service," Static:",ip,":",mask,@tab)
endif
endif
next
Hmmm, dusting off old code. This should find those pesky static IP addresses in 95/98:
IP = 0
For X = 0 to 9 by 1
If IP == 0 then IP=RegQueryValue(@REGMACHINE,"System\CurrentControlSet\Services\Class\NetTrans\000%X%[IpAddress]")
If IP == "0.0.0.0" then IP = 0
If IP != 0 then goto GotIP
Next
For Y = 10 to 25 by 1
If IP == 0 then IP=RegQueryValue(@REGMACHINE,"System\CurrentControlSet\Services\Class\NetTrans\00%Y%[IpAddress]")
If IP == "0.0.0.0" then IP = 0
If IP != 0 then goto GotIP
Next
If IP == 0 then IP="None or DHCP Enabled"
:GotIp
Message("This it?",IP)
Article ID: W14738
Filename: Look for the Bound IPs.txt